Trigger Reminder Notification based on Date/Time field value from Timer in Workflow

Hemant Kumar Ch
Kilo Sage

Hello Experts 

 

@Ankur Bawiskar 

 

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 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Hemant Kumar Ch 

you can use eventQueueScheduled method and schedule your email

https://docs.servicenow.com/bundle/sandiego-application-development/page/app-store/dev_portal/API_re... 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Uncle Rob
Kilo Patron

If you're using Flow Designer you could use the wait activity and just fire the notification directly.

https://youtu.be/FtOT4aDs7lo

Learn the 3 possible ways to trigger a notification in ServiceNow Flow Designer, the pros and cons of each, and which way Robert suggests as default. Lets build something together. rob (at) theduke (dot) digital MENTIONED IN THIS EPISODE Build a "Create Event" custom Flow Action: ...

Thanks Robert

 

As this is already developed solution ,So we have to go with workflow 

 

Any solution in respect of workflow ?

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Hemant Kumar Ch 

you can use eventQueueScheduled method and schedule your email

https://docs.servicenow.com/bundle/sandiego-application-development/page/app-store/dev_portal/API_re... 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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