How to pass the input variables of User Task to the appServices ?? #250
Replies: 4 comments 8 replies
-
When Calling AppServices from Trigger ScriptThe example you provided is an appServices.myMethod1({var1:50,var2:'some text'},this); therefore, inside your method, you can: class AppServices
// ... more here
async myMethod1(input,item) {
const dataVar1=context.data.var1;
} When Calling Service TasksThe proper syntax is as follows: Input/Output Parameters are set as follows: class AppServices
// ... more here
async echo(input, context) {
console.log('service echo - input', input);
context.item.data['echo']=input;
return input;
} When you inspect the passed values |
Beta Was this translation helpful? Give feedback.
-
Yes, Use |
Beta Was this translation helpful? Give feedback.
-
I don't know anything about Camunda, use bpmn-web editor (under Task listener) or just edit the xml file: <bpmn:userTask id="task_Buy" name="Buy" camunda:assignee="$(this.data.starterUserId)" camunda:candidateUsers="User1,User2" camunda:candidateGroups="Employee,Manager" camunda:dueDate="$this.dueDate" camunda:followUpDate="2023-10-31" camunda:priority="5">
<bpmn:documentation>A User Task</bpmn:documentation>
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="needsRepairs" label="Repairs Required?" type="boolean" defaultValue="No" />
<camunda:formField id="needsCleaning" label="Cleaning Required?" type="boolean" defaultValue="No" />
</camunda:formData>
<camunda:taskListener event="validate">
<camunda:script scriptFormat="JavaScript">
console.log(data);
if (data.needsRepairs==="")
return {error: 'Invalid values'}
</camunda:script>
</camunda:taskListener>
</bpmn:extensionElements>
<bpmn:incoming>flow_start_buy</bpmn:incoming>
<bpmn:outgoing>flow_buy_gw</bpmn:outgoing>
</bpmn:userTask>
|
Beta Was this translation helpful? Give feedback.
-
The input value is in the input stream, either in item.input or item.data during |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @ralphhanna,
Good Afternoon !!
We have a requirement where we define some input variables to the user task and we want to pass the input variables to the appServices defined method. Today, i could see from the provided examples in the bpmn-web only passing the

this
, which is context. Is there anyway that we can pass inputs ?Thank You in advance
Beta Was this translation helpful? Give feedback.
All reactions