- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2020 01:33 AM
Hello,
I would like once a user comments something on an approval form (for example an approval of a requested item), the comments to be copied to the comment field of the requested item.
I would like to achieve the following:
1) Once the approver opens an approval form, he/she will be able to see all the comments that have been added in the RITM until that time.
2) Once the approver comments on the approval form, the comment to be added on the comments field of the RITM.
For example, on below screen, my user ("AAAA") opens the approval form. However, he is not able to see all the comments that have need added until now on the RITM. Then, we post a comment, this comment must be added to the comments field of the RITM.
Thank you so much all.
Solved! Go to Solution.
- Labels:
-
Request Management
- 3,161 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2020 04:36 AM
Hi,
so it is going in loop.
please add this in both the BRs
var updateInitiatedBy = updateInitiatedBy || current.sys_id.toString();
(function executeRule(current, previous /*null when async*/) {
if(updateInitiatedBy != current.sys_id.toString()){
return;
}
// your code to update
})(current, previous);
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
‎11-11-2020 01:39 AM
Hi,
Please create after update BR on sysapproval_approver table
Condition: Comments Changes AND current.source_table == 'sc_req_item'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.sysapproval);
ritm.comments = current.comments.getJournalEntry(1);
ritm.update();
})(current, previous);
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
‎11-11-2020 02:00 AM
I guess the code that you kindly provided copies the approver's comments to RITM comments.
How can I make also the other way around? The RITM comments to be copied on the approval's comments.
So, when a user opens an approval form, he/she will be able to see all the comments of the RITM until that time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2020 02:10 AM
Hi,
for other way round use this
I assume user has valid READ ACL to see the comments on both the forms
After update BR on sc_req_item table
Condition: Comments changes
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var appr = new GlideRecord('sysapproval_approver');
appr.addQuery('sysapproval',current.sys_id);
appr.query();
if(appr.next()){
appr.comments = current.comments.getJournalEntry(1);
appr.update();
}
})(current, previous);
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
‎05-19-2022 04:08 AM
Hii Ankur,
when approver approve the request and add comments then that comment will be display to only requester(me) and approval. but we want to display that comments to all approver but it is noyt showing .could you give me some solution for this issue?