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

@Hemant Kumar Ch 

yes you can trigger email at particular time using that function.

I responded to your question for 5mins and 20mins

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