JBoss Community

Re: Jbpm 5 user form variables

created by Matthew Wojtowicz in jBPM - View the full discussion

Thanks got this to work.

 

Code for Script before Human Task(Don't forget to add import java.util.HashMap):

map = new HashMap();
map.put("id",id);
map.put("priority",priority);
map.put("quantity",quantity);
kcontext.setVariable("map", map);

map = new HashMap();

map.put("id",id);

map.put("priority",priority);

map.put("quantity",quantity);

kcontext.setVariable("map", map);

 

Then Human task Node

 

<userTask id="_2" name="Order Evaluation" >

      <ioSpecification>

        <dataInput id="_2_ContentInput" name="Content" />

        <dataInput id="_2_CommentInput" name="Comment" />

        <dataInput id="_2_SkippableInput" name="Skippable" />

        <dataInput id="_2_TaskNameInput" name="TaskName" />

        <inputSet>

          <dataInputRefs>_2_ContentInput</dataInputRefs>

          <dataInputRefs>_2_CommentInput</dataInputRefs>

          <dataInputRefs>_2_SkippableInput</dataInputRefs>

          <dataInputRefs>_2_TaskNameInput</dataInputRefs>

        </inputSet>

        <outputSet>

        </outputSet>

      </ioSpecification>

      <dataInputAssociation>

        <sourceRef>map</sourceRef>

        <targetRef>_2_ContentInput</targetRef>

      </dataInputAssociation>

      <dataInputAssociation>

        <targetRef>_2_CommentInput</targetRef>

        <assignment>

          <from xs:type="tFormalExpression">Please create an order.</from>

          <to xs:type="tFormalExpression">_2_CommentInput</to>

        </assignment>

      </dataInputAssociation>

      <dataInputAssociation>

        <targetRef>_2_SkippableInput</targetRef>

        <assignment>

          <from xs:type="tFormalExpression">false</from>

          <to xs:type="tFormalExpression">_2_SkippableInput</to>

        </assignment>

      </dataInputAssociation>

      <dataInputAssociation>

        <targetRef>_2_TaskNameInput</targetRef>

        <assignment>

          <from xs:type="tFormalExpression">Order Evaluation</from>

          <to xs:type="tFormalExpression">_2_TaskNameInput</to>

        </assignment>

      </dataInputAssociation>

      <potentialOwner>

        <resourceAssignmentExpression>

          <formalExpression>krisv</formalExpression>

        </resourceAssignmentExpression>

      </potentialOwner>

    </userTask>

 

I accessed the variables in my ftl as ${id} ${priority}. DO NOT use ${content.id} or ${map.id}

Reply to this message by going to Community

Start a new discussion in jBPM at Community