Add Approve/ Reject Button on the change form

Samiksha2
Mega Sage

Hi All,

I have a requirement to add Approve/ Reject Button on the change form. I tried the below script but it is make all the approver no longer required including who approves it. And state is not changing.

Samiksha2_0-1702643541903.png

 

Thanks,

Sam

 

1 ACCEPTED SOLUTION

Aniket Chavan
Tera Sage
Tera Sage

Hello @Samiksha2 ,

Please refer the below articles once:

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

Regards,
Aniket

View solution in original post

9 REPLIES 9

Hi @Aniket Chavan ,

Thanks,

Sam

 

Hello @Samiksha2 ,

Glad to hear that my response helped you, also can you please mark 👍Helpful that would be great.

Thank you, Have a great day and weekend ahead!!


Regards,
Aniket

Shamma Negi
Kilo Sage
Kilo Sage

Hi ,

 

Check the state backend value. May be it is not "approved" rather some digit value like 1,2,3, etc.

 

Regards,

Shamma

Regards,Shamma Negi

SunilKumar_P
Giga Sage

Hi @Samiksha2,

 

Do you have the state choice 'Approved' on the Change Form? If yes, then once confirm the choice value.

 

If you are trying to set the state of Approval record then you need to glide record the sysapproval_approver table.

 

You can test the below script to set the state of the Approval record to approved.

 

var grApr =  new GlideRecord("sysapproval_approver");
grApr.addQuery('sysapproval', current.sys_id);
grApr.addQuery('approver', gs.getUserID());
grApr.addQuery('state', 'requested');
grApr.query();
if(grApr.next()){
    grApr.state = 'approved';
    grApr.update();
}
new global.UIActionUtils.approvalsNoLongerRequired(curren.sys_id); // To set the remaining approvals to No loger required,
 
Regards,
Sunil

Josh Pirozzi
Kilo Sage

Hi @Samiksha2 ,

 

I'm in agreement with @Dr Atul G- LNG on this one. Although a client/customer is requesting something, after performing some research and gathering the understanding of the 'why' the OOTB setup doesn't suffice, I would lean toward the side of caution and recommend not customizing the system.