- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2024 10:18 AM
can all involved approvers being listed in message body or only the approval recipient? or can show count of total approver?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2024 10:50 AM - edited 04-27-2024 11:06 AM
Hi @vinnus ,
Look I tried your problem in my PDI and it works for me I'm adding images for reference
I created before BR on sc_req_item and added below code
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var appArr = []
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);
gr.query();
while(gr.next()){
appArr.push(gr.approver.getDisplayValue());
}
gs.eventQueue('send.approval.notificatio', current, current.number, appArr);
})(current, previous);
Than I create event at I called in the script
Than in email notification I called the parm 1 and parm 2
Below is result
Note: If you want to call the email scirpt you can also use the below code
In notificaition you can call like this - ${mail_script:scriptName}
Add below code
Result of email script
Notification
Email Script
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var appArr = []
gs.log('Hree in email script = ' + current.sys_id)
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);
gr.query();
while (gr.next()) {
appArr.push(gr.approver.getDisplayValue());
}
template.print(appArr);
})(current, template, email, email_action, event);
Output:
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2024 10:02 PM
Hi @vinnus,
You can write an email script to get all approvers in the email body. You can refer to the below sample code.
// Add your code here var appArr = [] var gr = new GlideRecord('sysapproval_approver'); gr.addQuery('sysapproval', current.sys_id); gr.query(); while(gr.next()){ appArr.push(gr.approver.getDisplayValue()); }
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
04-27-2024 10:34 AM
Hi @vinnus ,
You could write a mail script which calls the approval table and pulls all the approver names and you can call that in your notification
Please mark my answer helpful/correct if it resolved your query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2024 10:02 PM
Hi @vinnus,
You can write an email script to get all approvers in the email body. You can refer to the below sample code.
// Add your code here var appArr = [] var gr = new GlideRecord('sysapproval_approver'); gr.addQuery('sysapproval', current.sys_id); gr.query(); while(gr.next()){ appArr.push(gr.approver.getDisplayValue()); }
Please mark this response as correct or helpful if it assisted you with your question.