Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

regarding email notifications

shreya_3009
ServiceNow Employee
ServiceNow Employee

I want to fetch all the approvers from the flow and add it in email script and that script is being used in a notification.So when the notification triggers all the approvers name should be displayed related to that request.
how can i write the script for this?

3 REPLIES 3

DGAJ
Giga Guru

Hi @shreya_3009 ,

There is a similar article in the community you can reference to :

 

https://www.servicenow.com/community/developer-forum/list-all-approvers-in-an-email-notification/td-...

 

*******************************************************************************************
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards,

DGAJ

Sujit Jadhav
Tera Guru

Hello @shreya_3009 ,

You can use below script step in flow designer

(function execute(inputs, outputs) {
var approverList = [];
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', inputs.requestSysId); // Pass the request Sys ID as input
gr.query();
while (gr.next()) {
if (gr.approver.name) {
approverList.push(gr.approver.name);
}
}
outputs.approvers = approverList.join(', ');
})(inputs, outputs);

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

Thank You,

Sujit Jadhav

shreya_3009
ServiceNow Employee
ServiceNow Employee

in the approval set i have 3 levels of approval.how can i use that in code to fetch all of them