set a timer in workflow based on a variable

Jan-Z
Giga Expert

Is it possible to create a workflow timer based on a variable date?


The termination date is defined as a date type in the variable set. I would like to put a timer in the workflow to send a task to the HR dept 14 days before the termination date.

I don't know if I can create a timer in a workflow based on a variable.

10 REPLIES 10

TJW2
Mega Guru

You can set a timer based on a script and read the variable value.
OR
You can also create a field on the record and store the variable value (this field does NOT have to shown on the form). This allows you to select the field in the Timer activity.
Select 'Timer based on: a date/time or duration field',
Select field name,
Select 'Wait: some time before'.
The system will then wait the appropriate amount of time for you (no scripting).


Hi Terry,



Equally same is my requirement ,


its like there is field in offboarding form called required duration.


there is a workflow for disabling and deleting the windows user account , disable windows gets created as soon as the request for offboarding is approved and delete windows gets created after a 30 days interval.



but now the requirement is that when the user selects the required duration field(it can be 30 days 90days or any date provided in the calender) based on that field delete windows task should be created any idea how to achieve this?


Jan-Z
Giga Expert

Terri - Thanks for your response. I like the idea of creating a field and not having to script.
To do this I would create a field on the form but then how would I declare the value? Would I declare the field to show the same as the variable when chosen?

You can also create a field on the record and store the variable value (this field does NOT have to shown on the form)


Create the field on the form, Termination Date (u_termination_date)
In your workflow have a 'Run Script' activity as your first activity
In the Run Script set your value as follows:
current.u_termination_date = current.variables.term_date; // sub term_date with your variable name

You can write a UI Policy to hide the 'Termination Date' field on the form.

NOTE: If you allow the user to change the Termination Date this is more complicated.