Moving File Locations with the Execute Expression Robot
This topic provides a sample of using the Execute Expression robot node to move a file from one folder to another.
Referenced Workflow
changeFolderTest.xml
Description
The following expression checks if the workflow has been assigned a primaryBusinessObject. If so, it moves the object from its current location to the System folder.
Instructions
If the object already exists in the System folder, you will see no change, thus, you should either create a new object in a folder other than /System or cut and paste the existing document to a different folder.
Copy the following code:
// Check if a PBO has been assigned to the process
if (primaryBusinessObject !=null) {
try {
wt.folder.Folder f = wt.folder.FolderHelper.service.getFolder( "/System");
//move the PBO to the '/System' folder
wt.folder.FolderHelper.service.changeFolder((wt.folder.FolderEntry )primaryBusinessObject, f );
}
catch ( wt.util.WTException wex ) {
System.out.println( "Cannot move "+ primaryBusinessObject.getDisplayIdentifier( )+"because "+ wex.getLocalizedMessage( )}
}
}
else
// if a PBO has not been assigned to the Process
System.out.println( "Primary business object is NULL");
Was this helpful?