Move files with an expression robot
We have a workflow for submitting a file to a library. As part of that workflow, once an EPMDocument is approved, we want to move it to a specific folder. There's sample code listed on the support page that (after correcting typos) doesn't work. Instead, it comes up with a "Context not found: "Windchill PDM"" error.
I tried changing the folder path in place of the default "System" but that doesn't change anything.
Where should I look to next? What am I missing?
// 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");
A version of this question can be that instead of moving the files, once a file has been classified in the library is there a way to replace instances of it through APIs with the library component and then just delete the original submission?

