-
1. Re: getting process variables available in service task
micste Aug 12, 2013 9:57 AM (in response to fellowtom)I think that the mapping is wrong, try -> instead of =
{param->s}
If I use the editor in web designer to edit mappings a "is mapped to" is displayed as ->
-
2. Re: getting process variables available in service task
swiderski.maciej Aug 13, 2013 1:27 AM (in response to fellowtom)it depends when and how you read them from work item? They will be set when the work item node is triggered and not before that.
HTH
-
3. Re: getting process variables available in service task
fellowtom Aug 13, 2013 3:30 AM (in response to fellowtom)Hi,
thanks for your replies. I dont know how to change "=" to "->" since using the editor(eclipse-plugin) doesn't offer this ability. You can just type parameter and variable. And the xml(service task) looks like:
<serviceTask id="_4" name="Service Task" operationRef="_4_ServiceOperation" implementation="Other" > <ioSpecification> <dataInput id="_4_param" name="Parameter" /> <dataOutput id="_4_result" name="Result" /> <inputSet> <dataInputRefs>_4_param</dataInputRefs> </inputSet> <outputSet> <dataOutputRefs>_4_result</dataOutputRefs> </outputSet> </ioSpecification> </serviceTask>
So there is no mapping with my variable "s" visible here.
@Maciej: What do you mean with how/when i read from workItem? Here the sample code:
public class SampleServiceTask implements WorkItemHandler{ public void executeWorkItem(WorkItem workItem, WorkItemManager workItemManager) { System.out.println(workItem.getParameter("param")); workItemManager.completeWorkItem(workItem.getId(), null); } public void abortWorkItem(WorkItem workItem, WorkItemManager workItemManager) { System.out.println("Service task aborted."); } }
It makes no difference if I set "param" as precess variable on start or not ("s" ofc is set). I think I'm doing something very basic wrong atm.
Greeting,Tom
-
4. Re: getting process variables available in service task
swiderski.maciej Aug 13, 2013 4:26 AM (in response to fellowtom)alright, now I can see what's wrong. You have single data input defined for your service task and it's called Parameter so if you like to get it's value inside the work item handler you need to use exactly the name defined there:
System.out.println(workItem.getParameter("Parameter"));
and that should give you the expected value.
HTH
-
5. Re: getting process variables available in service task
fellowtom Aug 13, 2013 7:11 AM (in response to swiderski.maciej)Thank you very much. So it is.
Kind regards,
Tom