Hi,I have one small issue with the workflow.I have one URLexternal Task which is calling java class.Predecessor to this task there is one CGI Task which is returning list of variables.How can I fetch those variables into my java class?Every Help is appreciable!!!
...public void execute(CSClient client, CSExternalTask task, ...) { CSWorkflow job = task.getWorkflow(); String varval = job.getVariable("varname"); ...}
Is the CGITask setting task variables or job variables?If job variables, then you should be able to do something like:...public void execute(CSClient client, CSExternalTask task, ...) { CSWorkflow job = task.getWorkflow(); String varval = job.getVariable("varname"); ...}If it is a task variable, then you have to create the job object and from there get a list of task objects, iterate through them to find the task with the name of your CGITask, and then from that task object, retrieve the variable(s) you want.
public void execute(CSClient client, CSExternalTask currentTask, ......) throws CSException { String defaultTransition = Task.getTransitions()[0]; CSWorkflow job = Task.getWorkflow(); String TaskName = Task.getVariable(KEY_TARGET_TASK_NAME); //CSTask targetTask = getTaskByName(job, TaskName);}
Thanks for the help, we are using something like:public void execute(CSClient client, CSExternalTask currentTask, ......) throws CSException { String defaultTransition = Task.getTransitions()[0]; CSWorkflow job = Task.getWorkflow(); String TaskName = Task.getVariable(KEY_TARGET_TASK_NAME); //CSTask targetTask = getTaskByName(job, TaskName);} Is this the correct way to get the variable???
You have problems in the above code - or at least as far as what you've shown - because you have a parameter called currentTask and yet you seem to be using a variable called Task which does not appear to be defined.That aside, if KEY_TARGET_TASK_NAME is a String that contains the same value as the name of a task-level variable that exists on the task referenced by Task - then yes, you should be able to retrieve the value of that variable like that.If the variable is attached to a different task - then you have to get that task object first and then use it to get the value of the task variable you're looking for.If the variable is attached to the job - you should be able to get it off of the job object you appear to have created above.
Hi Ghoti,Thanks, I updated the currentTask to Task. Yes KEY_TARGET_TASK_NAME is a string in which we are passing the Task Name from where we are getting the variables. I dont understand the term "task-level variable" Should we define the variable name instead of Task Name to get the variables?The requirement is that we need to get all the variables from the CGI Task to the java class and use them for further processing.