TS 6.7.1 SP1 Patch 2 on Linux
I have a pre-processor script for a workflow model that is designed to auto-select the reviewer for the workflow job based on who the current user is. We wrote the java code to do this and it is functioning correctly. We started by writing that value back to a workflow variable (workflow.addVariable("Reviewer",rval)

and that turns out to have been working. The issue is that it sets a Task Variable at the workflow level. Can someone tell me how to then set a global variable to the value of that task variable, if at all possible???
I then modified the code to try and get the Review Task, get the list of reviewers and delete them and then add the value that we found for the proper reviewer. The problem with this is that it is finding the Review Task, removing the default user from the reviewer list, but it's not adding any reviewers back to the task, so in the job instantiation screen, the Reviewer drop-down is empty. Here is the code for that chunk:
//Retrieve all the tasks of the workflow
//and store them in an array of WFMTask
WFMTask[] tasks=workflow.getTasks();
System.out.println("Number of tasks is " + tasks.length);
//Loop through the array, identify the Review task,
//and modify its properties
for (int i = 0; i < tasks.length; i++) { System.out.println("Task is " + tasks.getClass());
if(tasks instanceof WFMReviewTask) {
System.out.println("We have a review task");
WFMReviewTask revtask=(WFMReviewTask)tasks;
List currusers = revtask.getReviewerUsers();
System.out.println("Currusers is " + currusers);
if (currusers != null && currusers.size() > 0) {
System.out.println("We have a current user value " + currusers.size());
revtask.removeReviewerUser((String)currusers.iterator().next());
List newUser = new java.util.ArrayList();
newUser.add(rval);
revtask.addReviewerUsers(newUser);
} else if (currusers != null && currusers.size() == 0) {
System.out.println("currusers is empty, set it to rval");
currusers.add(rval);
revtask.addReviewerUsers(currusers);
}
}
}
I'm not sure that the getReviewerUsers is working correctly as the value of currusers is printing out as "[]". I do see the last comment of "currusers is empty, set it to rval" in the log, so I know it's falling into the else. If someone can help point me in the right direction with either option, I'd appreciate it!
One note, I'm not a Java developer by nature, so if anything above is butchered up, please go easy on me!!!

Thanks!