Adding timer in Business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 02:05 AM
Hello behind the notification I need to put a timer before triggering the notification in Business rule.
What code can I use/add?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 02:26 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 07:10 PM
But Is it possible to add timer in Business rule before can trigger the email?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 08:56 PM
what's the usecase to add timer?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader