- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 03:22 AM
Hi All
In ritm form is some one is approved or rejected the approval then the same message has to be updated in work notes as well, How we can achieve this?
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 06:29 AM
No No. Please see my updated comment . I am posting it again with details which you need to try:
BR Details:
Table name: sysapproval_approver
When: After Update
Condition: Comments Changes
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.comments.getJournalEntry(1);
gr.update();
}
})(current, previous);
BR:
Result:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 03:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 03:56 AM
Hi,
are you saying if someone rejects approval and adds some comments; then that should be copied to RITM?
if yes then you can do this
1) after update BR on sysapproval_approver
2) condition: current.source_table == 'sc_req_item' && current.state == 'rejected'
Script:
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.sysapproval);
ritm.comments = current.comments;
ritm.update();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 04:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 06:51 AM
Hi,
update as this
I hope you are giving comments when you are rejecting the approval record
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.sysapproval);
ritm.comments = current.comments.getJournalEntry(1);
ritm.update();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader