AnsweredAssumed Answered

Passing in variable timer duration

Question asked by gerry.fisher on Jan 28, 2011
Latest reply on Jan 28, 2011 by ronald.van.kuijk
Does anyone know how to pass in a variable timer duration?

Here's what my definition looks like:

<process id="groupApprovalWorkflow">
  
      <startEvent id="startArtworkReview"/>
      <sequenceFlow id="startsArtworkReview" sourceRef="startArtworkReview" targetRef="reviewArtwork"/>
      <userTask id="reviewArtwork">
         <humanPerformer>
            <resourceAssignmentExpression>
              <formalExpression>${userId}</formalExpression>
            </resourceAssignmentExpression>
        </humanPerformer>
      </userTask>
      <sequenceFlow id="endsArtworkReview" sourceRef="reviewArtwork" targetRef="endArtworkReview"/>
      <endEvent id="endArtworkReview"/>
     
      <boundaryEvent attachedToRef="reviewArtwork" cancelActivity="false" id="triggerEmailReminder">
         <timerEventDefinition>
            <timeDuration>${completionDeadline}</timeDuration>
         </timerEventDefinition>
      </boundaryEvent>
      <sequenceFlow id="sendsEmailReminder" sourceRef="triggerEmailReminder" targetRef="sendEmailReminder"/>
      <serviceTask id="sendEmailReminder" activiti:class="com.kallik.process.utils.SendEmailReminder"/>
      <sequenceFlow id="continuesArtworkReview" sourceRef="sendEmailReminder" targetRef="reviewArtwork"/>
     
   </process>

Here's the code to start the process:

Map<String, String> form = new HashMap<String, String>();
form.put("userId", userId);
form.put("completionDeadline", "PT30S");
         
ProcessInstance processInstance = ProcessServices.getFormService().submitStartFormData(processDefinitionId, form);

I'm getting a thrown exception saying that ${completionDeadline} cannot be resolved. The definition works correctly when I replace ${completionDeadline} variable by the constant PT30S.

Outcomes