- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2022 09:32 PM
Hello All,
We want to update Approval / Rejected status on Comments /work_Notes in RITM.
Eg .
If the Request is approved/rejected by the approver.
Your Request has been Approval / Rejected by Abel tutor (approver Name)
How can we achieve this please support.
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2022 11:04 PM
Hi @akin9 ,
You can write an after BR on approval table (sysapproval_approver)
Please mark my response as helpful/correct if this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2022 09:42 PM
you can use after update BR on sysapproval_approver
Condition: (current.state == 'approved' || current.state == 'rejected') && current.source_table == 'sc_req_item'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
if (gr.next()) {
gr.work_notes = current.work_notes.getJournalEntry(1);
gr.update();
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2022 10:54 PM
Did you get a chance to check on my above response?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2022 11:00 PM
Hello @Ankur Bawiskar
Thank you for your quick reply,
I have Used the above your script unfortunately not working for me.
Requirment is Once RITM is Approval / Rejected below comments need to be auto populate.
Your Request has been Approval / Rejected by Abel tutor (approver Name)
Please check the below pls correct me what i missed here.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2022 11:05 PM
Hi @akin9
Try this:
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.document_id);
gr.query();
if(gr.next()){
gr.work_notes = 'Your request has been '+ current.state + ' by ' +current.approver.name;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 02:14 AM
script shared by me should work fine.
you could have debugged and enhanced it further.
can you share what did you write and what didn't work
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader