AnsweredAssumed Answered

How to persist (archive) user task form property data?

Question asked by bbarani on Feb 28, 2013
Latest reply on Mar 1, 2013 by bbarani

I am trying to archive the task along with custom form properties.

Please find below the user task… I am calling the archive service task (java class) once the user selects one of the enum value (Yes or No).

<userTask id="confirmApproval" name="Approve the picture request"
         activiti:candidateUsers="${user}" activiti:assignee="${user}">

            <activiti:formProperty id="initiator" name="Initiator:"
               type="string" />

            <activiti:formProperty id="approvalConfirmed"
               name="approvalConfirmed" type="enum" required="true">
               <activiti:value id="true" name="Yes"></activiti:value>
               <activiti:value id="false" name="No"></activiti:value>

Java Class:

public class ArchiveTask implements org.activiti.engine.delegate.JavaDelegate

   public void execute(DelegateExecution execution) throws Exception {
      Map<String, String> properties = new HashMap<String, String>();

      String assigneeName = (String) execution.getVariable("user");
      boolean approval = (Boolean) execution.getVariable("needsApproval");
      TaskService taskService = execution.getEngineServices()
      List<Task> tasks = taskService.createTaskQuery()
      for (Task task : tasks) {

       ProcessDefinition definition = execution.getEngineServices().getRepositoryService()
      FormService formService = execution.getEngineServices()
         List<FormProperty> formList = formService.getStartFormData(definition.getId()).getFormProperties();
         System.out.println(formList.size()+" Form List size");
         System.out.println(definition.getId()+" Definition Id ");
      try {
         properties = new HashMap<String, String>();
         properties.put("initiator", "kermit");
         properties.put("approvalConfirmed", "Yes");
         formService.submitTaskFormData(definition.getId(), properties);
      } catch (ActivitiException e) {



For some reason my formList size is always 0, can someone let me know what I am doing wrong?