Sushant20_0-1669300102040.png

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

In first we are getting Abel tutor as expected  but why we are getting twice?

 

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

View solution in original post

Hi @Gunjan Kiratkar ,

 

what if it need to get approval from sysapproval_group group name to be added in additional comments .. 

 

Many Thanks,

Rajan

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