cancel
Showing results for 
Search instead for 
Did you mean: 

How can i make a Process wait for a certain amount of time before going to next Task.

piyush_kaizen
Champ in-the-making
Champ in-the-making
How can i make the process wait during it's execution for Variable amount of Time which is decided using previous tasks before it starts execution of the next Task.
3 REPLIES 3

warper
Star Contributor
Star Contributor
Hi Piyush!
You can use expressions in Timer Intermediate Catching Event. For example, if your previous task sets myvariable to "PT5M", this timer event will wait for 5 minutes:
<code>
<intermediateCatchEvent id="timer">
  <timerEventDefinition>
    <timeDuration>${myvariable}</timeDuration>
  </timerEventDefinition>
</intermediateCatchEvent>
</code>

piyush_kaizen
Champ in-the-making
Champ in-the-making
What is wrong with the process definition given below

  <process id="Timer1" name="Timer1" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript" activiti:autoStoreVariables="false">
      <script>java.lang.System.out.println("Testing");</script>
    </scriptTask>
    <sequenceFlow id="flow1003" sourceRef="scripttask1" targetRef="endevent1"></sequenceFlow>
    <intermediateCatchEvent id="timerintermediatecatchevent1" name="TimerCatchEvent">
      <timerEventDefinition>
        <timeDuration>PT100S</timeDuration>
      </timerEventDefinition>
    </intermediateCatchEvent>
    <sequenceFlow id="flow1004" sourceRef="startevent1" targetRef="timerintermediatecatchevent1"></sequenceFlow>
    <sequenceFlow id="flow1005" sourceRef="timerintermediatecatchevent1" targetRef="scripttask1"></sequenceFlow>
  </process>

It does not wait and Script Task gets Executed Immediately.

warper
Star Contributor
Star Contributor
I don't know, timer works for me…
<code>04:05:11 INFO  [HlaProcessTest:108] ####################### start testProcess1 ############################
04:05:11 INFO  [CommonEventListener:48] PROCESS_STARTED: executionId=16, processInstanceId=16, processDefinitionId=testProcess1:1:11
04:05:11 INFO  [ActivityEventListener:125] >>> START: Timer1(testProcess1) VARS: {}
04:06:52 INFO  [CommonEventListener:48] TIMER_FIRED: activityName={"activityId":"timerintermediatecatchevent1"}, executionId=18, processInstanceId=16, processDefinitionId=testProcess1:1:11
Testing
04:06:53 INFO  [ActivityEventListener:98] <<< END: Timer1(testProcess1) VARS: {}
04:06:53 INFO  [CommonEventListener:48] PROCESS_COMPLETED: executionId=16, processInstanceId=16, processDefinitionId=testProcess1:1:11
04:07:11 INFO  [SpringBaseTest:94] — tearDown —
04:07:12 INFO  [HlaProcessTest:114] ######################## end testProcess1 ############################</code>
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.