Is there any way to get "Approval Comments" to go to a SC Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2013 06:09 AM
Is there anyway I can get "Approval Comments" to show up in the "SC Task"? So it goes to the support group. Approvers might change a role for someone and they comment there and they are getting missed cause they don't go to the task... TIA
- 6,984 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2013 06:44 AM
Yes, for one of our items I copy the approval comments to the Description field in the sc_task with this code in the Advanced Script field on the Catalog Task workflow activity that creates the task. This is for an approval on the Request Item, if you wanted to find an approval attached to the Request, you'd query for current.request.sys_id instead of current.sys_id.
var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval',current.sys_id);
apv.query();
if (apv.next()) {
task.description += "\nApproval Comments:\n" + apv.comments;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2015 01:35 AM
Hi Zach,
Im hoping you might be able to help me with a query I have on this if possible.
I have 2 levels of approval on the catalogue - the Request and the RITM.
In order to transfer the comments from the Request approval to the Task I use 'apv.addQuery('sysapproval',current.request.sys_id);'
To transfer the comments from the ritm approval to the task I use 'apv.addQuery('sysapproval',current.sys_id);',
However, I want to transfer both together into the Task.
Ive been able to do it by using the below (basically adding the script twice and changing the one line). It adds both sets of comments but seems to transfer one of the comments in twice.
Did you encounter this at any point?
var apv = new GlideRecord('sysapproval_approver');
apv.addQuery('sysapproval',current.request.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.comments += "\nApproval Comments: from " + apv.approver.name + "\n" + apv.comments.getJournalEntry(-1); // add approver name here
}
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.comments += "\nApproval Comments: from " + apv.approver.name + "\n" + apv.comments.getJournalEntry(-1); // add approver name here
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2013 07:52 AM
I tried that and i see the wording Approval Comments but for some reason it doesn't put the actual comments in there. is there a special ACL that i need to open up. I didn't think so since IT can see the comments. Would it matter cause we have 2 approvals on a RITM - Manager then the Role Owner?
We have our approvals on the RITM also.. not REQ
See screenshot i can see them there but not in the task..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2013 07:53 AM
There are 3 approvals on that RITM and the code I pasted was only desgined to deal with one approval. Given that situation, I'd modify it so it will go through all of the approvals, find only those with comments, and add the comments to the task:
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 += "\nApproval Comments: from " + apv.approver.name + "\n" + apv.comments; // add approver name here
}