how to send 2 different email to different people.

TMKAM
Tera Contributor

I have an issue to create a workflow and notification as per below scenario.

 

scenario 1

1. user submit catalog request.

2. 1st email approver is to HOD number 1 with different email content.

3. Approved by the 1st email approver which is the HOD number 1.

4. 2nd email approver is to HOD number 2 with different email content.

5. Approved by the 2nd email approver which is the HOD number 2.

6. email notification send to the requester.

 

I have created 2 email notification.

1st email approver is HOD number 1.

2nd email approver is to HOD number 2.

 

I attach the workflow and notification for your reference.

20 REPLIES 20

TMKAM
Tera Contributor

Hi Addy,

The problem is both email notification was send even the hod 1 has not approved yet and hod 2 already receive an email notification.

Please use send notification activity in workflow, it will be simple and will work properly in your case.

Otherwise if you want to go with your existing work, you can write script in advanced condition and check if any approval for the current record has been approved or not.

Ankur Bawiskar
Tera Patron
Tera Patron

@TMKAM 

Usually whenever approval is generated an OOTB email notification associated with approval.inserted event triggers

If you want content as per your ITEM then you should do this

1) ensure the OOTB email notification on sysapproval_approver doesn't trigger for your item

var gr = new GlideRecord("sc_req_item");
    gr.addQuery("sys_id", current.sysapproval);
    gr.addQuery('cat_item.name', "Your Item name");
    gr.query();
    answer = !gr.hasNext();

2) create a new email on sysapproval_approver and it should trigger when "approval.inserted" event triggers and this should trigger for only your item. use advanced notification condition

var gr = new GlideRecord("sc_req_item");
    gr.addQuery("sys_id", current.sysapproval);
    gr.addQuery('cat_item.name', "Your Item name");
    gr.query();
    answer = gr.hasNext();

Next you can attach email script to your newly created notification to handle different content based on level of approval

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

Do u mean the script need to be inserted in the emal notification "Advanced Condition"?

@TMKAM 

correct in the advanced notification condition field of notification

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader