Send Email Notification to all approver listed in RITM, when the RITM approved for the specific item

AbdulrehmanT
Kilo Guru

Good Afternoon from Pakistan
Guys, I need your help, I have a requirement to send the approval email notification to all approvers listed in the RITM, when the approver approve the RITM, with the information of Requested for

Can anyone please guide me or provide me the solution that will be really helpfull for me
Thanks in advance

3 REPLIES 3

mayankkumar
Kilo Patron
Kilo Patron

Hi @AbdulrehmanT,
Try adding these steps in your flow after any of the approver approved the RITM

  1. Query approvers: Use "Look up Records" step to get all approvers for the RITM

  2. Loop through approvers: Use "For Each" step

  3. Send email: Use "Send Email" action with:

    • To: Current approver's email

    • Subject: "RITM Approval Notification - [RITM Number]"

    • Body: Include:

      • Requested For: [requested_for]

      • RITM Number: [number]

      • RITM Description: [short_description]

      • Approved By: [approved_by]

Modify Fields according to your requirement, let me know if you need further help
------------------------------------------------------------------------------------------------------------------------------------------------
Please mark my response helpful and accept as solution
Thanks & Regards
Mayank

Thanks for your response but this approach I cant use..................
I have created a email notification on sys_approval table
I have created a event registery on sys_approval table
I have created a business rule on sc_req_item.LIST
RUN WHEN: item is laptop and approval state changes to approved
than in the advanced script im using the below code,

(function executeRule(current, previous) {

// // Safety check
// if (!current.sysapproval)
// return;

// Collect all approvers for this RITM
var recipients = [];
var appr = new GlideRecord('sysapproval_approver');
appr.addQuery('sysapproval', current.sys_id);
appr.query();

while (appr.next()) {
if (appr.approver) {
recipients.push(appr.approver.toString());
}
}

// Fire event with approver list
gs.eventQueue(
'auto.approval',
current,
recipients.join(','), // parm1 = all approver sys_ids
current.approver.toString() // parm2 = approver who approved
);

})(current, previous);



the above code is not working,..............it should send the approval email to all approvers listed in the approval

Hi @AbdulrehmanT 

 

Mohammed8_0-1766173251130.png

I don't think  sc_req_item  where u run this business rule has approver field, can u check this part and confirm

 

Regards,

Mohammed Zakir