- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2022 10:48 PM
Hi All,
I need to copy approver comments to SCTASK work notes and below is script added to the WF when catalog task is created. I have followed the https://community.servicenow.com/community?id=community_question&sys_id=9e9bcb61db9cdbc01dcaf3231f96...
The approver comments are copied over sctask but it is copying multiple times and I am trying to get my head around why it is doing that. There are multiple approvers on the RITM and once it is approved it should copy the approver comments to sctask work notes. Am I missing something here?
var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval', current.sys_id);
apv.addQuery('comments', '!=', ''); // Only find approvals that have comments on them
apv.query();
while (apv.next()) { // Go through all approvals with comments
task.work_notes += "\nApproval Comments: from " + apv.approver.name + "\n" + apv.comments.getJournalEntry(-1);
}
Any help is appreciated.
Thank you.
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2022 10:54 PM
Hi,
update as this
var arr = [];
var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval', current.sys_id);
apv.addQuery('comments', '!=', ''); // Only find approvals that have comments on them
apv.query();
while (apv.next()) { // Go through all approvals with comments
arr.push("Approval Comments: from " + apv.approver.name + "\n" + apv.comments.getJournalEntry(-1));
}
task.work_notes = arr.join('\n');
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
‎09-18-2022 10:54 PM
Hi,
update as this
var arr = [];
var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval', current.sys_id);
apv.addQuery('comments', '!=', ''); // Only find approvals that have comments on them
apv.query();
while (apv.next()) { // Go through all approvals with comments
arr.push("Approval Comments: from " + apv.approver.name + "\n" + apv.comments.getJournalEntry(-1));
}
task.work_notes = arr.join('\n');
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
‎09-18-2022 11:11 PM
It worked!!.
Thank you