Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Adding timer in Business rule

Uchel
Tera Contributor

Hello behind the notification I need to put a timer before triggering the notification in Business rule.

What code can I use/add?

 

Uchel_0-1686214742391.png

 

7 REPLIES 7

Sai Kumar B
Mega Sage

@Uchel 

Use gs.eventQueueScheduled(Event name, Object instance, String parm1, String parm2, Object expiration) to schedule events in the future, upon execution system creates an entry in the sys_trigger table and will schedule the trigger as per the Object expiration date/time parameter
For example, Please find the following sample code

var futureTime= new GlideDateTime();
futureTime.addDaysLocalTime(7); //Adding 7 days to current date time
gs.eventQueueScheduled('pass.event.name', Object instance, param1, param2, futureTime); //This will create entry in sys_trigger table and will trigger the event as per the futureTime, You can find the entry in the table and check the "Process Time" column value in record

If I could help you with my response you can mark it as helpful and correct as it benefits future viewers
Thanks,
Sai Kumar B

 

But Is it possible to add timer in Business rule before can trigger the email?

Ankur Bawiskar
Tera Patron

@Uchel 

what's the usecase to add timer?

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