Workflow timer to wait for if today is five days from the "effective date"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 11:31 AM
I'm trying to kick off a workflow task that will wait until today is 5 days from the "effective date" before kicking off the rest of the workflow creating a task etc.
Is this possible using the condition builder? A script will do.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 12:44 PM
Hey @Nathan Okh,
I am assuming it's Workflow not Flow, if so you can use a Timer workflow activity.
An example below:
// Set 'answer' to the number of seconds this timer should wait
var effectiveDate = new GlideDateTime(current.variables.getValue('effective_date'));
effectiveDate.addDays(5);
var nowGDT = new GlideDateTime();
answer = gs.dateDiff(nowGDT, effectiveDate, true);
Note that if you update the 'effective date' after the activity is executed, the timer will NOT reset.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2024 01:07 PM
Hi @Nathan Okh ,
If you're getting the value from a form field, set the value for Timer based on "A date/time or duration field" and then select your field.
If you're getting it from a variable, set the value for Timer based on "Script", then in the script field use the code below.
answer = gs.dateDiff(gs.nowDateTime(), current.variables.term_date, true);
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda