Approval Rejection Notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2015 01:32 PM
A while ago, I requested assistance in this thread:
Change Request Rejected Comments
And was able to successfully get the notification to work. What has been happening, however, is the notification will get send back to the requester stating the change has been rejected, and the 'rejected by' user may not be the correct one. We have three levels of approval for change. For simplicity's sake, let's say:
Joe Smith
Jane Smith
Bob Manager
So, Joe approves, then Jane approves, and Bob rejects. The requester gets the notification email stating 'Your Change has been rejected by Jane Smith', which is incorrect. The change was rejected correctly, and if you look at the change form, everything is fine, just the notification is displaying incorrect info.
Here is the mail script:
<mail_script>
template.print("<span style=\"font-size: 10pt; font-family: Verdana, Arial\">Your Change Request <b>" + current.number + " - " + current.short_description + "</b> has been rejected with the following comments:");
// Select the proper table
var chRej = new GlideRecord("sysapproval_approver");
chRej.addQuery("sysapproval", current.sys_id);
chRej.query();
while (chRej.next()) {
email.setSubject("Your Change Request has been rejected by " + chRej.approver.getDisplayValue());
template.print("\n\n" + chRej.comments.getJournalEntry(1) + "\n");
template.print("</span>");
}
</mail_script>
I asked one of our implementation specialists to take a look and see if there was something wrong with this script. She suggested the issue is that there is nothing in that query that filters on the rejected approval or the last updated by. She suggested I try adding another query that looks for the approval being rejected:
chRej.addQuery("sysapproval", current.sys_id);
chRej.addQuery("approval", "rejected");
chRej.query();
So, I did just that, and the issue is still happening. Any idea as to what I can add/modify to make this work correctly? I'm sure I'm just missing something simple. I am not too sure what else to check. Any ideas would be appreciated!
Cheers,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2015 10:39 PM
I have an idea
If user trying to reject from "Reject" Ui action form button.
give conditioncurrent.state.changeTo('reject')
gs.eventQueue('eventname',current, current.assignedto, gs.getUser());
In notification select send event param1 user
ans set subject like below
email.setSubject("Your Change Request has been rejected by " + event.parm2); // It will give who reject
.
____________________________________________________
If user rejecting through the email notificatio
In inbound action write below code
gs.eventQueue('eventname',current, current.assignedto, email.from);
In notification select send event param1 user
ans set subject like below
email.setSubject("Your Change Request has been rejected by " + event.parm2); // It will give who reject
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 07:05 AM
Thanks Harish. I had looked at using an event, as that's how the 'Approval Rejected by other' notification works. I'll investigate this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 06:14 AM
did you check on the users in fields... approval for.assigned to and approval for. requested by... we have assigned to but not requested for
if not you can script an add to and add the approval.requested by in a mail script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 07:07 AM
Doug,
Yes, I did, thanks for the suggestion. The requested_by does not exist in any of the related fields. I'll look into the scripting piece.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 07:33 AM
email.addAddress("cc",splitThis[i]); //replace splitThis[i] with your sysapproval.requested_by