- 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,422 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 02:07 AM
Hi,
You can use below script that runs after insert/update & on Change of Comments on RITM table.
(function executeRule(current, previous /*null when async*/) {
var ritmapp = new GlideRecord('sysapproval_approver');
ritmapp.addQuery('sysapproval',current.sys_id);
ritmapp.addQuery('state','requested'); //copies only to pending approval records
ritmapp.query();
while(ritmapp.next())
{
ritmapp.comments = current.comments.getJournalEntry(-1); //-1 for latest n 1 for all comments
ritmapp.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2020 02:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2020 03:04 AM
For example, I have a requested item that needs two steps of approvals (stage 1 and stage 2).
On stage 1, Abel Tuter comments on approval form before approves the requested item, like shown below.
Then, after stage 1 being completed, on stage 2 the user must be able to see all the comments that been added to the previous stage.
However, the user can not see previous comments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2020 03:40 AM
Hi,
Did you try checking with admin user if that field is visible or not
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 04:04 AM
I really need your help Ankur, if you could help me on that, I would appreciate it so much, since I have spent many hours without finding a good solution..
The problem is the following:
I have a business rule on sc_req_item table (after insert-update, condition: additional comments changes), where I copy the comments of the requested item to the relative approvals.
I have a business rule on sysapproval_approver table (after update, condition: approvalfor.number starts with RITM and comments changes), where I copy the comments of the approval to the relative RITM.
So, its like I have a two-way relationship between RITM and approval.
The issue is that, when I comment on requested item, then the comment is copied on the approval (because of the first business rule), and the comment returns back to the requested item (because a new comment is added to the approval and the second business rule is triggered too).
Is it clear?