We have a process to check the folders and files attached to the workflow, if any file/directory cannot be deployed we need to remove that file from workflow.
I have written pre processor to do this. However the code below is not workking. Any ideas whether I am doing any thing wrong.
Given below snippets of code.
WFMWorkflow execute(WFMWorkflow wfmw, Map<String, String> map) {
WFMFile[] wfmFiles = wfmw.getFiles();
for(int i = 0; i < wfmFiles.length - 1; i++) {
String fileVpath = wfmFiles[i].getFilePath().replace("\\","/");
wfmw.removeFile(new WFMFile(fileVpath, "File removed by WFM"));
}
Also I have to add some default file using addFile funciton as follows. The code adds file successfully as it throws an exception if I try to add it multiple times saying "File is already attached to the workflow". However once the job is initiated, if open user task I dont see the files I have attached. Only I could see the files attached during the job initiation.
I am using the following code for adding file.
try{
wfmw.addFile(new WFMFile(fileVpath, "File added by WFM"));
}catch (WFMException wfme){
logger.error("Exception in PreInitiateProcess:execute():" + wfme);
}
I have seen the API docs and everything looks good.
Appreciate your thoughts.
Environment: TS7 using WFM, OS: Windows