AnsweredAssumed Answered

TaskFormData is null inside complete taskListener

Question asked by yourboogieman on Oct 24, 2013
Latest reply on Oct 26, 2013 by yourboogieman
I have a user task for which I am invoking a task listener when the task completes:

        <userTask id="getDoorInfo" name="Get door info" activiti:exclusive="false">
                <activiti:formProperty id="doorColor" name="Door color" variable="doorColor" readable="true" type="string" required="true" />
                <activiti:taskListener event="complete" expression="${formCollectionBuilder.addForm(execution)}" />
            <multiInstanceLoopCharacteristics isSequential="true">

The code which is being invoked by the listener is:

public class FormCollectionBuilder {
   public void addForm(DelegateExecution execution) throws Exception {
                final String taskId = execution.getCurrentActivityId();
      final String taskFormCollId = taskId + "FormCollection";
      List<List<FormProperty>> forms =
         (List<List<FormProperty>>) execution.getVariable(taskFormCollId);
      if (forms == null) {
         forms = new ArrayList<List<FormProperty>>();
         execution.setVariable(taskFormCollId, forms);
                TaskFormData formData = execution.getEngineServices().getFormService().getTaskFormData(taskId);
      final List<FormProperty> formProps = formData.getFormProperties();


The issue I am having is that the call to getTaskFormData is returning null.  Looking in my debugger at runtime, the task ID is "getDoorInfo", which is the correct one, so I can't figure out why this is returning null.  Any idea what I'm doing wrong?