Unofficial Content

The timer events allow you to set warnings, deadlines and delays in your processes. The time when an event occurs can be fixed when the diagram is created or it can be set at runtime.

For example, suppose you want to set a delay between two tasks (Task A and Task B).

During the modeling stage, you can set a timer as follows:

HowToTimer1_png

The intermediate event between the tasks will delay the beginning of Task B by one hour. It can be changed with the Timer duration property.

To set the delay time at runtime you must set the Timer expression type property as Procedure and associate a procedure with the Date expression procedure property:

HowToTimer2_png

The associated procedure must have the following parm rule:

parm( in:&WorkflowProcessDefinition, in:&WorkflowProcessInstance, in:&WorkflowWorkitem, out:&DateTime)

Where:

&WorkflowProcessDefinition is a WorkflowProcessDefinition Data Type variable
&WorkflowProcessInstance is a WorkflowProcessInstance Data Type  variable
&WorkflowWorkitem is a WorkflowWorkitem Data Type variable
&DateTime is a DateTime data type variable.

As a sample, suppose that in Task A you want to set a date by which the next task should be executed. To do this, you can set a relevant data, previously defined in the diagram, in the web panel associated with Task A, and then get the relevant data in the procedure associated with the Date expression procedure property.

Setting the relevant data in Task A:

Event Start
    &Workflowssrver.Connect("WFADMINISTRATOR","WFADMINISTRATOR")
endevent

Event Enter
    &WworkflowApplicationData = &WorkflowContext.ProcessInstance.GetApplicationDataByName('timer')
    &WorkflowApplicationData.DateTimeValue = &timer
    commit
    return
Endevent

Where:

&WorkflowServer is a Workflow Server Data Type variable.
&WorkflowApplicationData is a WorkflowApplicationData Data Type variable.
&WorkflowContext is a WorkflowContext Data Type variable.
&timer is a DateTime data type variable.
timer is the relevant data set in the diagram.

Getting the DateTime in the procedure:

&DateTime=&WorkflowContext.ProcessInstance.GetApplicationDataByName('timer').DateTimeValue
return

Once done this, when the established date is reached, the intermediate event will be triggered and Task B will start.

Note: The Timer Control scheduler must be running to trigger the timer events.

See Also

Timer usage property
Interrupts activity property
Timer definition property
Timer expression type property
Timer date property
Timer duration property
Timer cycle property
Date expression procedure property

 


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant