- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 06:29 AM
Its giving me like that second issues is cleared but i'm not getting the name of the current approval... Please have a look
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 06:38 AM
In first we are getting Abel tutor as expected but why we are getting twice?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 06:49 AM
Hi @Sushant20
Try below :-
(function executeRule(current, previous /*null when async*/ ) { // Add your code here
var GroupApp = [];
var appr = new GlideRecord('sysapproval_approver');
appr.addEncodedQuery('state=requested^sysapproval=' + current.sys_id);
appr.query();
while (appr.next()) {
GroupApp.push(appr.getDisplayValue('approver')).toString();
}
current.setWorkflow(false);
current.autoSysFields(false);
if(GroupApp.length>0){
current.comments = 'Approvals For RITM :- \n' + GroupApp;
current.update();
}
})(current, previous);
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 09:27 PM
Hi @Gunjan Kiratkar ,
what if it need to get approval from sysapproval_group group name to be added in additional comments ..
Many Thanks,
Rajan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 06:38 AM - edited 11-24-2022 06:59 AM
Hello @Sushant20 Can you try this below script ?
You BR should be after insert BR on sysapproval_approver table
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',current.sysapproval);
gr.addQuery('state','requested');
gr.query();
if(gr.next());
{
gr.comments = "Approved By :"+gr.approver.getDisplayValue();
gr.update();
}
})(current, previous);
Hope this helps
Mark my answer correct if this helps you
Thanks