The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

when Request is cancelled Send notification to Requester, Assigned to & Approver

Arjun Reddy Yer
Tera Contributor

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:

 

 

yerasumalli_1-1679974873179.png

yerasumalli_2-1679974924058.png

yerasumalli_3-1679974973844.png

Event:

 

yerasumalli_4-1679975149625.png

Business Rule:

 

yerasumalli_5-1679975526787.png

yerasumalli_6-1679975579288.png

 

2 ACCEPTED SOLUTIONS

Gopi Naik1
Tera Guru

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);

 

 

 

 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi

View solution in original post

Aman Kumar S
Tera Sage
Tera Sage

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

 

Best Regards
Aman Kumar

View solution in original post

9 REPLIES 9

Gopi Naik1
Tera Guru

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);

 

 

 

 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi

Need to create Async Business Rule with the script that you had mentioned

(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);

You can create After or Async with required conditions.

 

 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi