approval rejected notification for requested item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2016 06:25 AM
Hi All,
OOB approval rejected notifications just go to the Approver?
I need to inform the person who created the requested item, or created the request. (Should be straight forward right?)
Tried this and it is not working: Send Approval Rejected Notification to Requested For
I have also tried updating the Business Rule to generate an event - and these Events are working but the notifications are not being triggered!!
I have also tried created the events from within the workflow!
I feel like I am jumping over something very basic and in the process of losing my hair - any guidance/assistance/pointing out the obvious would be much appreciated

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2016 08:07 AM
Did you change the code in the business rule.? You can pass the opened_by as an event parameter. Can you post the code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 08:24 AM
Hi there
I too have tried everything to get this to send to the requester/opened by to also include the rejection note .. can you let me know what you did to get this working
thanks
nadia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 08:46 AM
If you want to do this with an event, as you were talking about, just make sure you pass the "Requested For" as one of the Event Parameters, then when you build your Email Notification, trigger by the event you created, and check the "Email recipient in Parm1/Parm2" as appropriate.
A simpler solution is to just add a Notification block to your workflow in the branch that happens when Approval is Rejected, which we just did with a customer, but because they had a common workflow that applied to dozens of items. If you use a different workflow for each item, it'd be pretty painful to edit all of those workflows. Using an event to trigger an email notification is the better option.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 09:22 AM
I have done something similar to how Rejection notifications work for Change Requests whereby the notification is on the Change Request record.
What I do is create a custom event on the table for the record being approved (in your case you would create the event on the sc_req_item table).
You could send the event from the workflow and have the current.request.requested_for be one of the event parms.
Then in your notification you set the Email recipient in Parm1 or Email recipient in Parm2 depending upon which parm you use when you send the event.
I created a script include that is called by a Notification Email script that pulls the rejection comments from all rejected approval records. You could also get the rejection comments in a similar fashion within the workflow and pass that in the other parm.
Let me know if you are interested and I can share what I built.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 01:53 PM
I have gone ahead and created a solution you can try:
1. Create a custom event in the Event Registry:
Event name: sc_req_item.rejected
Table: Requested Item [sc_req_item]
Description: Custom event used to send notifications when the Requested Item is rejected
Fired by: Workflow
2. Create a Script Include that captures all of the rejected comments:
Name: ApprovalUtils
Application: Global
API Name: global.ApprovalUtils
Accessible from: All application scopes
Description: Custom Include with common Approval methods
Script:
var ApprovalUtils = Class.create();
ApprovalUtils.prototype = {
initialize: function() {
},
getRejComments: function(recID) {
var approv = new GlideRecord('sysapproval_approver');
approv.addQuery('document_id', recID);
approv.addQuery('state', 'rejected');
approv.query();
var appArray = [];
while (approv.next()) {
appArray.push(approv.comments.getJournalEntry(1));
}
return appArray.sort();
},
type: 'ApprovalUtils'
};
This method will capture comments from all rejected approval records which you may want to have if you are waiting for multiple rejections.
3. Change your workflow to leverage the script include
You will change your workflow following your rejection path to send the notification along with the rejection comments. Depending upon what version of ServiceNow you are running will determine how you do this:
3a. For Geneva and Below:
You will need to capture the output of the script include and save it to a workflow_scratchpad variable for use in the Create Event Workflow Activity:
- Create a Run Script Workflow Activity:
Name: Get Rejection Comments
Script:
workflow.scratchpad.reject = getReject();
function getReject() {
var sInc = new ApprovalUtils();
var rNotes = sInc.getRejComments(current.sys_id);
rDesc = 'This Change was rejected for the following reason:<br/>';
for (r = 0; r < rNotes.length; r++) {
cStr = rNotes[r];
var retStr = cStr.replace(/\n/g, '<br/>');
rDesc += retStr;
}
return rDesc;
}
- Create Event Workflow Activity:
Name: Send Rejection Notification
Event name: sc_req_item.rejected
Parameter 1: workflow.scratchpad.reject
3b. For Helsinki and above:
You do not need to create a Run Script Workflow Activity and save to a workflow_scratchpad as you can script directly from the Create Event Workflow Activity:
Name: Send Rejection Notification
Event name: sc_req_item.rejected
Parameter 1:
(function() {
var parStr = getReject();
return parStr;
}());
function getReject() {
var sInc = new ApprovalUtils();
var rNotes = sInc.getRejComments(current.sys_id);
rDesc = 'This Requested Item was rejected for the following reason:<br/>';
for (r = 0; r < rNotes.length; r++) {
cStr = rNotes[r];
var retStr = cStr.replace(/\n/g, '<br/>');
rDesc += retStr;
}
return rDesc;
}
4. Create your Notification:
Name: RITM - Reject
Table: Requested Item [sc_req_item]
Send when: Event is fired
Event name: sc_req_item.rejected
Users/Groups in fields: Request.Requested for
Content type: HTML only
Subject: Your requested item ${number} for ${cat_item} has been rejected
Message HTML:
${event.parm1}
The benefits of this solution is that you can trigger it on-demand depending upon whatever workflow you want to run it with. It also allows for this to work with approvals other than Catalog Items by changing the event, changing the verbiage used for Parameter 1 in the Create Event Workflow Activity, and creating a notification using the proper recipients.
Let me know if you try this solution and are successful or not.