Notifications based on the approval

PALAVALASAB
Tera Contributor

Hi guys,

I need to send a notification to the remaining approvers once an approver approves or rejects a RITM. The notification content should differ based on whether the request was approved or rejected.

For example, if there are two approvers for a RITM and one of them approves it, the other approver should receive a notification stating that the request has been approved and no further action is needed.

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@PALAVALASAB 

so what did you start with and where are you stuck?

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

Hi @Ankur Bawiskar,

I’m working on setting up notifications using the sysapproval_approver table. I’ve configured the notification to trigger when the state changes to Accepted or Rejected.

However, I’m facing a challenge with the recipients. I need the notification to be sent only to the approvers whose state is Not Required, but the “Who will receive” section doesn’t provide a scripting field where I can use a Script Include or custom logic to filter the recipients.

Bhuvan
Giga Patron

@PALAVALASAB 

 

If you have Flow Designer Flow for this, create Flow logic based on the approval status and send email notifications accordingly.

 

If you have configured Flow but it is not working, share more details.

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

MaxMixali
Giga Guru

ServiceNow – Notification to Remaining Approvers on RITM Approval or Rejection

Requirement
When one approver acts (approves or rejects) a Requested Item (RITM), send a different notification to the *remaining* approvers to inform them of the action taken and whether further action is needed.

Solution Overview
This can be achieved using a combination of:
1. Flow Designer or Workflow to detect approval state change.
2. Notification with scripted recipients or notification trigger script.
3. Optional: business rule on sys_approval_approver table.

Approach 1 – Flow Designer (recommended)
------------------------------------------------------------
1. Create or modify the existing RITM Approval Flow:
- Trigger: Table = sc_req_item (RITM), Condition = Approval state changes.
- Add a “Wait for condition” action → Wait until “Approval state changes” from “requested” to “approved” or “rejected”.

2. Add “Lookup Records” Action:
- Table: sys_approval_approver
- Conditions:
* parent = current RITM
* state = requested (to capture remaining approvers)
- Store results in a variable (e.g., remainingApprovers).

3. Add “If / Else” logic based on the Approval State:
IF Approval State == "approved" → send “Approved Notification”.
IF Approval State == "rejected" → send “Rejected Notification”.

4. Add a “Send Notification” action:
- Recipients: remainingApprovers.sys_user
- Subject/Body examples:

**Approved Notification Example:**
Subject: Request ${current.number} Approved
Body: Hello ${recipient.name},

The request ${current.number} has been approved by another approver. No further action is required.

Thank you.

**Rejected Notification Example:**
Subject: Request ${current.number} Rejected
Body: Hello ${recipient.name},

The request ${current.number} has been rejected by another approver. No further action is required.

Please contact the requestor for additional information.

Approach 2 – Business Rule on sys_approval_approver
------------------------------------------------------------
1. Table: sys_approval_approver
2. When: after update
3. Condition: current.state changes to “approved” OR “rejected”.
4. Script:

(function executeRule(current, previous) {
if (previous.state == current.state)
return;

// Only run if approval is for RITM
var ritm = new GlideRecord('sc_req_item');
if (!ritm.get(current.sysapproval))
return;

// Get remaining approvers
var approvers = new GlideRecord('sys_approval_approver');
approvers.addQuery('sysapproval', ritm.sys_id);
approvers.addQuery('state', 'requested');
approvers.query();
while (approvers.next()) {
var mail = new GlideEmailOutbound();
mail.setFrom(gs.getProperty('glide.email.username'));
mail.setTo(approvers.approver.email);
if (current.state == 'approved') {
mail.setSubject('Request ' + ritm.number + ' Approved');
mail.setBody('The request ' + ritm.number + ' has been approved by another approver. No further action is needed.');
} else if (current.state == 'rejected') {
mail.setSubject('Request ' + ritm.number + ' Rejected');
mail.setBody('The request ' + ritm.number + ' has been rejected by another approver. No further action is needed.');
}
mail.send();
}
})(current, previous);

Approach 3 – Email Notification Record
------------------------------------------------------------
If you prefer to use standard notifications:
1. Create two notifications:
- “Notify Remaining Approvers – Approved” (condition: Approval.state changes to Approved)
- “Notify Remaining Approvers – Rejected” (condition: Approval.state changes to Rejected)
2. Table: sys_approval_approver
3. Condition: current.state == 'approved' or 'rejected'
4. Scripted Recipient (in the notification):
```js
var recipients = [];
var others = new GlideRecord('sys_approval_approver');
others.addQuery('sysapproval', current.sysapproval);
others.addQuery('state', 'requested');
others.query();
while (others.next()) {
recipients.push(others.approver);
}
recipients;
```
5. Notification Body: customize per state.

Best Practice Recommendations
------------------------------------------------------------
- Prefer Flow Designer for maintainability.
- Avoid hardcoding approvers or emails.
- Include logic to handle group approvals if needed.
- Ensure notifications do not trigger if all approvals are completed.

Summary
------------------------------------------------------------
- Trigger on approval state change (sys_approval_approver).
- Identify remaining approvers where state = "requested".
- Send state-specific notifications (“Approved” vs. “Rejected”).
- Best to implement using Flow Designer for clarity and upgrade safety.