- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2019 01:27 AM
Hello,
I have a custom date/time field placed in the incident form - once this is changed a business rule is triggered and notification should be sent at the time specified in given date/time field.
In my Business Rule I decided to use this method:
gs.eventQueueScheduled('on.hold.reminder', current, 'parm1', 'parm2' , gs.getValue('u_on_hold_reminder'));
u_on_hold_reminder - the date/time field mentioned
I made a notification which is sent once an event 'on.hold.reminder' is triggered as per the method above.
The problem is that it is triggered everytime the date/time field is changed and it does not reflect the date/time value for schedulling the event, not sure if I supply these parameters correctly.
Can anyone please advise?
Many thanks.
Milan
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2019 02:25 AM
gs.eventQueueScheduled does not return a value. so your if condition wont pass.
remove the If condition and place the code it should work fine.
Example:
gs.eventQueueScheduled('on.hold.reminder', current, 'parm1', 'parm2', current.u_on_hold_reminder);
current.state = 'Assigned';
current.assigned_to = "";
current.update();
Please refer to docs for more details on API: https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_SGSYS-eventQSched_S_O_S_S_O
Thanks,
Vivek Anand
Please Note: If my response helps you to fix this issue, please mark it as correct!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2019 01:51 AM
HI Milan,
When i look at your code i issue is with the parameters you pass. you need to pass 'current.u_on_hold_reminder.getDisplayValue()' instead of gs.getValue('u_on_hold_reminder')
Thanks,
Vivek Anand
Please Note: If my response helps you to fix this issue, please mark it as correct!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2019 02:01 AM
Hi Vivek,
unfortunately the notification gets triggered as soon as the date/time field value is changed even after your suggested code change...
Not sure how to pass this date/time parameter to the method...
Thanks anyway,
Milan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2019 02:17 AM
Vivek,
FYI: I tested this twice and it works 🙂
gs.eventQueueScheduled('on.hold.reminder', current, 'parm1', 'parm2', current.u_on_hold_reminder);
Thanks! Milan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2019 02:19 AM
Yes, Milan.
gs.eventQueueScheduled('on.hold.reminder', current, 'parm1', 'parm2', current.u_on_hold_reminder);
Need to pass an Object as 5th parameter.
Thanks,
Vivek Anand
Please Note: If my response helps you to fix this issue, please mark it as correct!