- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 09:08 AM
Hi All,
Im making a workflow for a request.
Its all working well but im struggling with one bit ..
There is an approval widget and the 'approved' branch then goes to a new catalog task.
In that catalog task, I want to reference the name of the person who approved it.
So for example, somewhere in the description of the catalog task , i would like a line that says "this has been approved by xxxx"
But i cant find a way to reference the approvers name - can anyone help me with a way to achieve this please ?
Many thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 09:52 AM
Hi,
There can be one person approving it or more than 1 also approving it for say Group Approval is there are any. So I would suggest here is write a Script in the Advanced section of your Catalog task activity and use the script below:
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval',current.sys_id);
gr.addQuery('state','approved');
gr.query();
while(gr.next()){
task.description = 'This Request has been approved by ' + gr.getDisplayValue('approver');
}
Use this script in the screenshot below in Catalog Task activity itself:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 09:24 AM
Hi,
In your catalog task activity your can use advance script part and use GlideRecord query to get approver name.
var approverName='';
var appGr = new GlideRecord('sysapproval_approver');
appGr.addQuery('sysapproval_approver',current.sys_id.toString());
appGr.addQuery('state','approved');
appGr.orderByDesc('sys_updated_on');
appGr.query();
if(appGr.next()){
approverName.appGr.approver.getDisplayValue();
}
If the your catalog request is having only one approval before (not group approval) before this task is generated then you can use the same script which you have used to set approval to get approver name. Like requested for manager (because he is the only approver )
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 09:26 AM
Hi Andy,
In the Catalog task activity try below.
var getapprovedby=new GlideRecord('sysapproval_approver');
getapprovedby.addQuery('sysapproval',current.sys_id);
getapprovedby.orderByDesc('sys_updated_on');
getapprovedby.addQuery('state','approved');
getapprovedby.setLimit(1);
getapprovedby.query();
if(getapprovedby.next())
{
current.short_description='Record is approved by '+getapprovedby.approver.getDisplayValue();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 09:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 09:52 AM
Hi,
There can be one person approving it or more than 1 also approving it for say Group Approval is there are any. So I would suggest here is write a Script in the Advanced section of your Catalog task activity and use the script below:
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval',current.sys_id);
gr.addQuery('state','approved');
gr.query();
while(gr.next()){
task.description = 'This Request has been approved by ' + gr.getDisplayValue('approver');
}
Use this script in the screenshot below in Catalog Task activity itself:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke