Hello .
We are using jbpm as workflow engine .
The UserTask in jbpm has DataInput with name TaskName
<bpmn:dataInput id="UserTask_0cuiapk_TaskName" itemSubjectRef="__UserTask_0cuiapkTaskNameItem" name="TaskName" />
and we can assign value to this input using DataInputAssociation
<bpmn:dataInputAssociation>
<bpmn:targetRef>UserTask_0cuiapk_TaskName</bpmn:targetRef>
<bpmn:assignment>
<bpmn:from>Some Value</bpmn:from>
<bpmn:to>UserTask_0cuiapk_TaskName</bpmn:to>
</bpmn:assignment>
</bpmn:dataInputAssociation>
What Iām trying to do is creating this association using the following code :
let dataInputAssociationTag = moddle.create('bpmn:DataInputAssociation');
let targerRef = moddle.create('bpmn:ItemAwareElement', { id: dataInput.id });
dataInputAssociationTag.targetRef = targerRef;
let assignmentTag = moddle.create('bpmn:Assignment');
let from = moddle.create('bpmn:Expression', { body: Some Value });
let to = moddle.create('bpmn:Expression', { body: dataInput.id });
assignmentTag.from = from;
assignmentTag.to = to;
dataInputAssociationTag.get('assignment').push(assignmentTag);
inputAssociations.push(dataInputAssociationTag) ;
The generated xml is :
<bpmn:dataInputAssociation>
<bpmn:assignment>
<bpmn:from>Some Value </bpmn:from>
<bpmn:to>UserTask_0cuiapk_TaskName</bpmn:to>
</bpmn:assignment>
<bpmn:targetRef>UserTask_0cuiapk_TaskName</bpmn:targetRef>
</bpmn:dataInputAssociation>
The jbpm library cannot parse the xml becuase targetRef tag is after assignment tag