Email Notification Trigger

LakshmanV
Tera Contributor

Hai,

I have an issue in the email notification triggering in the workflow
1. i want to trigger an email to the request person who raised the request and also the approvers who needs to approve that request
2. And also i need after the RITM is in closed state i need trigger an email to the user, opened by and also watchlist 

4 REPLIES 4

Satishkumar B
Giga Sage
Giga Sage

Hi @LakshmanV 

1. Trigger Email to Requestor and Approvers:

  • Create or Modify Notification:

    • Table: sc_req_item
    • Condition: When request item is created or approval status changes.
  • Recipients:

    • Requestor: Use Requestor recipient type.
    • Approvers: Use script to add approvers

 

var gr = new GlideRecord('sc_req_item');
if (gr.get(current.sys_id)) {
    var approvers = gr.approver; // Adjust based on field
    notification.recipients.add(approvers);
}

 

 

2. Trigger Email After RITM is Closed:

  • Create or Modify Notification:

    • Table: sc_req_item
    • Condition: current.state == <Closed State>
  • Recipients:

    • Requestor: Use Requestor recipient type.
    • Opened By: Add via script:

 

notification.recipients.add(current.opened_by.email);

 

 

  • Watchlist: Add via script:

 

var watchlist = current.watch_list;
var userGR = new GlideRecord('sys_user');
while (watchlist.next()) {
    userGR.get(watchlist.user);
    notification.recipients.add(userGR.email);
}

 

 

  • Compose Email: Design email body with request details and completion info.

Save and test each notification to ensure correct operation.

……………………………………………………………………………………………………

Please Mark it helpful 👍and Accept Solution✔️!! If this helps you to understand. 

 

LakshmanV
Tera Contributor

Thanks for the Reply
i need this email notification through work flow

Hi @LakshmanV 

 

Please refer this:

https://docs.servicenow.com/bundle/washingtondc-build-workflows/page/administer/workflow-activities/...

https://docs.servicenow.com/bundle/washingtondc-build-workflows/page/administer/workflow-activities/...

 

…………………………………………..
Mark it helpful 👍and Accept Solution !! If this helps you to understand.

LakshmanV
Tera Contributor

I am unable to the send the email in the requested item -- watchlist employees below is the attachment which i specified in the flow