- 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 02:20 AM
Just one more question, after the event is triggered (gs.eventQueueScheduled) I need field "state" to be set to one of the choices which is "assigned" and field "assigned_to" needs to be empty.
I tried this but it does not work...
Any idea how to do this? Many thanks 🙂
Milan
(function executeRule(current, previous /*null when async*/) {
gs.eventQueueScheduled('on.hold.reminder', current, 'parm1', 'parm2', current.u_on_hold_reminder);
if(gs.eventQueueScheduled('on.hold.reminder', current, 'parm1', 'parm2', current.u_on_hold_reminder)) {
current.state = 'Assigned';
current.assigned_to = "";
current.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2019 02:22 AM
Maybe script action is better?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2019 02:29 AM
Yes, if you want to schedule this change after you trigger your notification, you can configure a script action. You are right.
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: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 02:46 AM
I tried this in script action and it just does not work, not sure why...
setIncFields();
function setIncFields() {
current.state = 'Assigned';
current.assigned_to = '';
current.update();
}
Any idea?
Many thanks, Milan