Approval table get comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2018 09:50 PM
Hi all,
I can't get comment on approval table.
var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval',current.sys_id);
apv.addQuery('comments','!=',''); // add this to only find approvals that have comments on them
apv.query();
while (apv.next()) { // change if to while so it will go through all approvals with comments
task.short_description += "\nApproval Comments: from " + apv.approver.name + "\n" + apv.comments.getJournalEntry(-1); // add approver name here
}
that script not working.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2018 10:05 PM
relation between Change Request & Approval , in approval table can be identified by document id
where document id is your change request number's sys_id
below scripts works to get all comments from sysapproval_approver table for said change request
var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('document_id','d2cdb552db252200a6a2b31be0b8f5ee');
apv.addQuery('comments','!=',''); // add this to only find approvals that have comments on them
apv.query();
while (apv.next()) { // change if to while so it will go through all approvals with comments
gs.info(apv.comments.getJournalEntry(-1)); // add approver name here
}
Hit Answer Correct & Helpful; if solved your queries or reply back if any other query

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2019 01:20 PM
var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval',current.sys_id);
apv.addQuery('comments','!=',''); // add this to only find approvals that have comments on them
apv.query();
while (apv.next()) { // change if to while so it will go through all approvals with comments
task.description += "\n" + apv.state.getDisplayValue() + " - Comments from " + apv.approver.name + " for " + apv.wf_activity.name + ":\n" + apv.comments.getJournalEntry(-1); // add approver name here
}