- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2019 04:50 AM
Hello,
I have a business rule, which triggers an event and sends notification after the event is triggered.
This works, however it should also change values of an incident form and this does not work, not sure why...
Business Rule (event triggered, notofcation tied to the BR sent..):
(function executeRule(current, previous /*null when async*/) {
gs.eventQueueScheduled('on.hold.reminder', current, 'parm1', 'parm2', current.u_on_hold_reminder);
})(current, previous);
Script Action screen shot below (not working - not setting the values as required....)
Any idea why?
Thanks a lot.
Milan
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2019 11:11 PM
Hello Milan,
1. Create after UPDATE Business rule and add below code:
(function executeRule(current, previous /*null when async*/) {
if(current.u_off_hold_date != previous.u_off_hold_date){
gs.addInfoMessage("DATE:"+current.u_on_hold_reminder+" Updaated:"+current.sys_updated_on);
gs.eventQueueScheduled ("on.hold.reminder'" , current , gs.getUserID ( ) , gs.getUserName ( ) , current.u_on_hold_reminder) ;
})(current, previous);
2. Add log in script action: add log:
gs.log("Number:"+current.number);
current.state ='9';
current.assigned_to ='sysId of assigned to';
current.udpate();
3. Go to the Event log where you can find out the event when it is processed compare it the the updated date log.
I think issue is with running timing of event or script action.
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2019 05:33 AM
My question would be why bother with the Script Action at all? Why not add that code to the Business Rule?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2019 10:06 PM
If you deactivate the notification, does it trigger the script action then?
Also add some debug statements in the script action to know, if it is entering the script action.
For ex add gs.info('++++++Entering Script action+++++++'); in line 1
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2019 10:24 PM
I did try, just the same result..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2019 10:38 PM
Did you check the system log to find out if the gs.info printed in the logs.
If not , For testing, can you change it to gs.eventQueue and try
(function executeRule(current, previous /*null when async*/) {
gs.eventQueue('on.hold.reminder', current, 'parm1', 'parm2');
})(current, previous);
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2019 11:11 PM
Hello Milan,
1. Create after UPDATE Business rule and add below code:
(function executeRule(current, previous /*null when async*/) {
if(current.u_off_hold_date != previous.u_off_hold_date){
gs.addInfoMessage("DATE:"+current.u_on_hold_reminder+" Updaated:"+current.sys_updated_on);
gs.eventQueueScheduled ("on.hold.reminder'" , current , gs.getUserID ( ) , gs.getUserName ( ) , current.u_on_hold_reminder) ;
})(current, previous);
2. Add log in script action: add log:
gs.log("Number:"+current.number);
current.state ='9';
current.assigned_to ='sysId of assigned to';
current.udpate();
3. Go to the Event log where you can find out the event when it is processed compare it the the updated date log.
I think issue is with running timing of event or script action.
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade