Timer event with time set dynamically based on process instance variables

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2016 11:17 AM
Hi,
I'm very new to Activiti. I have a basic process set up in XML with a few tasks and some branching, along the way setting and reading process instance variables. I would now like, at some point in the process, to be able to have the process pause and wait until a certain time is reached. I believe I can do this with a timer event like:
<blockcode>
<timerEventDefinition>
<timeDate>2011-03-11T12:13:14</timeDate>
</timerEventDefinition>
</blockcode>
However I would like it to get the timeDate setting dynamically from variables on the process instance. Is there a way to do this with timer event? Or another way of approaching this requirement?
Any help greatly appreciated, thanks!
I'm very new to Activiti. I have a basic process set up in XML with a few tasks and some branching, along the way setting and reading process instance variables. I would now like, at some point in the process, to be able to have the process pause and wait until a certain time is reached. I believe I can do this with a timer event like:
<blockcode>
<timerEventDefinition>
<timeDate>2011-03-11T12:13:14</timeDate>
</timerEventDefinition>
</blockcode>
However I would like it to get the timeDate setting dynamically from variables on the process instance. Is there a way to do this with timer event? Or another way of approaching this requirement?
Any help greatly appreciated, thanks!
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2016 01:10 AM
Hi,
Yes, it should be possible.
One of our requirement, we were used execution variable inside the timeEventDefinition. we want to repeat the same process after certain interview, so we have used "R1/PT2M" via execution variable.
Here is code snippet.
<code>
<boundaryEvent id="boundarytimer4" name="Timer" attachedToRef="sid-A9FA5F1E-66A8-4E7B-A6AF-A8105A56BDD4" cancelActivity="false">
<timerEventDefinition>
<timeCycle>${dueDateRemainderInterval}</timeCycle>
</timerEventDefinition>
</boundaryEvent>
<serviceTask id="alfrescoScripttask1" name="Calculate timer cycle " activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
<extensionElements>
<activiti:field name="script">
<activiti:string><![CDATA[//
dueDateRemainderInterval = "R1/PT2M"
execution.setVariable('dueDateRemainderInterval',dueDateRemainderInterval);
]]></activiti:string>
</activiti:field>
</extensionElements>
</serviceTask>
</code>
In your case, you can try like the below one.
<code>
<timerEventDefinition>
<timeDate>${dateVariable}</timeDate>
</timerEventDefinition>
</code>
Hope this helps you.
Yes, it should be possible.
One of our requirement, we were used execution variable inside the timeEventDefinition. we want to repeat the same process after certain interview, so we have used "R1/PT2M" via execution variable.
Here is code snippet.
<code>
<boundaryEvent id="boundarytimer4" name="Timer" attachedToRef="sid-A9FA5F1E-66A8-4E7B-A6AF-A8105A56BDD4" cancelActivity="false">
<timerEventDefinition>
<timeCycle>${dueDateRemainderInterval}</timeCycle>
</timerEventDefinition>
</boundaryEvent>
<serviceTask id="alfrescoScripttask1" name="Calculate timer cycle " activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
<extensionElements>
<activiti:field name="script">
<activiti:string><![CDATA[//
dueDateRemainderInterval = "R1/PT2M"
execution.setVariable('dueDateRemainderInterval',dueDateRemainderInterval);
]]></activiti:string>
</activiti:field>
</extensionElements>
</serviceTask>
</code>
In your case, you can try like the below one.
<code>
<timerEventDefinition>
<timeDate>${dateVariable}</timeDate>
</timerEventDefinition>
</code>
Hope this helps you.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2016 04:17 PM
Thank you so much. This did work!
