JBoss Community

Re: Jbpm 5 user form variables

created by Mauricio Salatino in jBPM - View the full discussion

Hi, the variables that you want to access inside the the Human task needs to be inserted in the content field

<dataInputAssociation>
        <targetRef>_5_ContentInput</targetRef>
        <assignment>
          <from xs:type="tFormalExpression">#{doctor.id}, #{ambulance.id},  #{patient.id}, #{patient.name}, #{patient.age}, #{patient.gender}, #{emergency.location}, #{emergency.type}</from>
          <to xs:type="tFormalExpression">_5_ContentInput</to>
        </assignment>
      </dataInputAssociation>

 

I have something like that in my process and then from your client side (Human Task Client UI):

 

client.start(taskSum.getId(), "control_operator", null);
        BlockingGetTaskResponseHandler handlerT = new BlockingGetTaskResponseHandler();
        client.getTask(taskSum.getId(), handlerT);
        Task task2 = handlerT.getTask();
        TaskData taskData = task2.getTaskData();
       
        System.out.println("TaskData = "+taskData);
        BlockingGetContentResponseHandler handlerC = new BlockingGetContentResponseHandler();
        client.getContent(taskData.getDocumentContentId(), handlerC);
        Content content = handlerC.getContent();
       
        System.out.println("Content= "+content);
        ByteArrayInputStream bais = new ByteArrayInputStream(content.getContent());
       
    ObjectInputStream ois = new ObjectInputStream(bais);
        String taskinfo =(String) ois.readObject();
        System.out.println("TASKINFO = "+taskinfo);
        //#{doctor.id}, #{ambulance.id},  #{patient.id}, #{patient.name}, #{patient.age}, #{patient.gender}, #{emergency.location}, #{emergency.type}
        String[] values= taskinfo.split(",");
       
        Assert.assertEquals(8 , values.length);

Reply to this message by going to Community

Start a new discussion in jBPM at Community