- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2017 12:53 PM
Hi all,
I was sure I had this script working somewhere before, but I can't seem to find it. This is my need:
When an approval goes out to our CEO he can click "reject this request" link and then send an email back to SN with the response. In the email back he will indicate how many days something needs to be on hold.
Our store team will need to see that number and enter that into a value on their task. The catch is that our store team isn't too tech savvy so we are trying to make this as painless as possible.
In short, I need to get this emailed back reject reason into the description of the task. I will totally be happy if I can just get it into the description of the RITM. I just can't seem to get the script working. I figured it would be pretty easy to dot walk into the "approving" (document_id) field but that doesn't seem to cut it.
Any ideas on what my script should look like would be extremely helpful.
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2017 01:17 PM
Hi Alex,
You can write below before update business rule on sysapproval_approver table, when state changes to Rejected.
var rec = new GlideRecord('sc_req_item');
rec.addQuery('sys_id',current.document_id);
rec.query();
if (rec.next())
{
rec.description = current.comments;
rec.update();
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2018 09:20 AM
Tried setting it this way, I ended up with an update of "Reason for rejection:" but no comment.
I'm adding the rejection comments on the portal - not sure if that is going to cause an issue?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2018 01:02 PM
Ok...Try this
var rec = new GlideRecord('sc_req_item');
rec.addQuery('sys_id',current.document_id);
rec.query();
if (rec.next())
{
rec.comments = "Reason for rejection: " +current.comments.getJournalEntry(-1);
rec.update();
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2018 07:15 AM
Hi Sanjiv,
I am also having the same requirement that once the RITM Request was rejected,then comments will get captured on the RITM Additional Comments.
Please let me know how to achieve the same.
I tried with the same script its working for me.
But I dont want to add the Journal Entry like date and time, instead of which I only want to post the Comments added by the Approver.
Thanks,
SNOW@Das

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 10:14 AM
Did you use a before business rule? Because before business rule shouldn't log the dates
Please mark this response as correct or helpful if it assisted you with your question.