- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 04:32 AM
Hello Experts
We have field called type Date/time "Access end Time." ,Now we are resuming the workflow next activity based on field date/time value; now we want to send a notification after 5 minutes and before 20 Minutes .How can we achieve this requirement
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 06:08 AM
you can use eventQueueScheduled method and schedule your email
I hope you have the understanding on how to create event, link notification with event. You just need to trigger the event based on your time. The event will be processed at that time which you pass in gdt
1) have run script in your workflow and use this to trigger email after 5mins from current date/time
var gdt = new GlideDateTime(current.<dueDateField>);
gdt.addSeconds(300);
gs.eventQueueScheduled('eventName, current, '<yourRecipientList>', '', gdt);
2) in same run script in your workflow use this to trigger before 20mins from due date
var gdt = new GlideDateTime();
gdt.addSeconds(-1200); // 20 mins is 1200 seconds and since you want to send before we are using - negative
gs.eventQueueScheduled('approval.reminder', current, '<yourRecipientList>', '', gdt);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 05:34 AM
If you're using Flow Designer you could use the wait activity and just fire the notification directly.
https://youtu.be/FtOT4aDs7lo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 05:48 AM
Thanks Robert
As this is already developed solution ,So we have to go with workflow
Any solution in respect of workflow ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 06:08 AM
you can use eventQueueScheduled method and schedule your email
I hope you have the understanding on how to create event, link notification with event. You just need to trigger the event based on your time. The event will be processed at that time which you pass in gdt
1) have run script in your workflow and use this to trigger email after 5mins from current date/time
var gdt = new GlideDateTime(current.<dueDateField>);
gdt.addSeconds(300);
gs.eventQueueScheduled('eventName, current, '<yourRecipientList>', '', gdt);
2) in same run script in your workflow use this to trigger before 20mins from due date
var gdt = new GlideDateTime();
gdt.addSeconds(-1200); // 20 mins is 1200 seconds and since you want to send before we are using - negative
gs.eventQueueScheduled('approval.reminder', current, '<yourRecipientList>', '', gdt);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 06:12 AM
Hello @Ankur Bawiskar
Do you know if we can use the same script in timer ?
If not, where should be run script placed in workflow ,Pre-timer or post-timer ?
Because we are triggering API from run script if the output is success then I want to place timer to wait till end time and based on time I need to trigger notifications