AnsweredAssumed Answered

Form within a usertask

Question asked by narenn on Mar 21, 2012
Latest reply on Aug 9, 2014 by mghb2009
I am using activity 5.9 (downloaded the latest version as of 3 weeks ago)

I am trying to post properties to a form within a usertask without luck!  If i submit formProperties using submitTaskFormData i get an errot that the task Id is not valid.  If i comment the line with submitTaskFormData everything works but the form properties are not visible to the form (test.form) under the user task handlerequest.  Is this a bug or i am doing something wrong here. Please advice and share a sample which has a form for a user task.  Also how do i view the form in the explorer with dynamic properties?  Thanks

My BPMN looks like this …..

      <startEvent id="start" activiti:formKey="org/activiti/examples/test/dummy.form" />
      
      <sequenceFlow id="flow1" sourceRef="start" targetRef="handleRequest" />
      <userTask id="handleRequest" name="Display Dump!"
         activiti:formKey="org/activiti/examples/test/test.form">
         <documentation> Sink Form !!!</documentation>
         <potentialOwner>
            <resourceAssignmentExpression>
               <formalExpression>management</formalExpression>
            </resourceAssignmentExpression>
         </potentialOwner>
      </userTask>

And Java code like this …

Deployment deploy = processEngine.getRepositoryService().createDeployment().name("org/activiti/examples/test/TestDumpData.bpmn20.xml").addClasspathResource("org/activiti/examples/test/TestDumpData.bpmn20.xml").deploy();

processEngine.getRepositoryService().createDeployment().name("org/activiti/examples/test/dummy.form").addClasspathResource("org/activiti/examples/test/dummy.form").deploy();

processEngine.getRepositoryService().createDeployment().name("org/activiti/examples/test/test.form").addClasspathResource("org/activiti/examples/test/test.form").deploy();

procDefId = processEngine.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("testDump").singleResult().getId();
      
Map<String, String> formProperties = new HashMap<String, String>();
formProperties.put("process", "Dump test!!");
formProperties.put("dump", "DUMP");
ProcessInstance instance = processEngine.getFormService().submitStartFormData(procDefId, formProperties);

Task task = processEngine.getTaskService().createTaskQuery().taskCandidateGroup("management").singleResult();
processEngine.getFormService().submitTaskFormData(task.getId(), formProperties);
TaskFormData taskForm = processEngine.getFormService().getTaskFormData(task.getId());

Outcomes