- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 08:58 PM - edited 03-27-2023 09:02 PM
Can anyone help me in getting the solution @priyasunku @Ankur Bawiskar @BharathChintala @Sumalatha Y @AnveshKumar M @Allen Andreas @asifnoor @Brad Tilton @Pradeep Sharma @Sonu Parab @Sandeep Dutta @Hemant Goldar @Mohit Kaushik
when Request is Cancelled Send notification to Requester, Assigned to & Approver (if Request is required for Approval).
I had written Notification, Created Event & written Business Rule but it's not triggering notification.
Notification:
Event:
Business Rule:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 09:24 PM
Hi @Arjun Reddy Yer ,
Remove recipients added in "Who will receive" section and check "event param1 contains recipients" as true. And use below code in business rule.
(function executeRule(current, previous /*null when async*/) {
var arr=[];
arr.push(current.requested_for.toString());
arr.push(current.assigned_to.toString());
var approval=new GlideRecord('sysapproval_approver');
approval.addQuery('sysapproval',current.sys_id.toString());
approval.query();
while(approval.next()){
arr.push(approval.approver.toString());
}
gs.eventQueue('sc_req_item.canceled',current,arr.toString());
})(current, previous);
Thanks,
Gopi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 09:25 PM - edited 03-27-2023 09:28 PM
Hi @Arjun Reddy Yer ,
The issue is with your BR condition, you should keep it as "Stage changes to Closed complete OR stage changes to Request Canceled".
You are using "and" condition instead.
ALso the eventQueue function the params are very critical, for your case it should be something like:
gs.eventQueue('sc_req_item.canceled',current, current.assigned_to,childAssignedTo.string());
And also mark event parm 1 contains recipients and 2 in the notification
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 09:25 PM - edited 03-27-2023 09:28 PM
Hi @Arjun Reddy Yer ,
The issue is with your BR condition, you should keep it as "Stage changes to Closed complete OR stage changes to Request Canceled".
You are using "and" condition instead.
ALso the eventQueue function the params are very critical, for your case it should be something like:
gs.eventQueue('sc_req_item.canceled',current, current.assigned_to,childAssignedTo.string());
And also mark event parm 1 contains recipients and 2 in the notification
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 09:34 PM
Is the below mentioned Business Rule Script is correct
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var childAssignedTo = [];
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request',current.sys_id); // or ritm.addQuery('request',current.sys_id);
ritm.query();
while(ritm.next()){
childAssignedTo.push(ritm.assigned_to);
}
gs.eventQueue('sc_req_item.canceled',current.assigned_to,childAssignedTo.toString());
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 10:12 PM
As I have mentioned above, change your few lines of code as below:
while(ritm.next()){
childAssignedTo.push(ritm.getValue("assigned_to"));// use of getValue is critical here
}
gs.eventQueue('sc_req_item.canceled',current,current.assigned_to,childAssignedTo.toString());
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 10:16 PM
Can you help me on issue which I'm facing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 09:51 PM
Can you help me on issue which I'm facing