The CreatorCon Call for Content is officially open! Get started here.

UI action shows unauthorized

AnandKumar1
Tera Expert

Hi Team,

I have an UI action for approvals to refer back for change module the UI action running for syapproval_approver table.. I couldn't find any issue with script but still when the approver initiate refer back getting "Action not authorized". Below my script and conditions. Can someone assist what is missing?

 

Condition: 

current.state =='requested' && tabName() && (gs.getUserID()==current.approver) && (current.sys_created_by!='*****_integration_user') && (current.sys_created_by!='**_integration_user') && (current.sysapproval.toString().indexOf('CHG')!=0)

 

SCRIPT:

 

function fun() {

gsftSubmit(null, g_form.getFormElement(), 'refer_back');

}


fun1();

function fun1() {
var val = current.comments;
var len = val.toString().trim().length;
if (len > 0) {

current.state = 'not requested';
current.update();


var grchg = new GlideRecord('change_request');
grchg.addQuery('sys_id', current.sysapproval);
grchg.query();
if (grchg.next()) {
grchg.u_refer_back = true;
grchg.setWorkflow(false);
grchg.update();
}
var app = new GlideRecord('sysapproval_approver');
app.addQuery('state', 'requested');
app.addQuery('sys_id', '!=', current.sys_id);
app.addQuery('sysapproval', current.sysapproval);
app.queryNoDomain();

while (app.next()) {
app.state = 'not requested';
app.update();
}

gs.eventQueue("change.refer.back.approval", current, gs.getUserID(), gs.getUserName());

action.setRedirectURL('https://' + gs.getProperty('instance_name') + '.service-now.com/change_request_list.do');

} else {

current.setAbortAction(true);
gs.addInfoMessage("Please fill in the Reason for Refer Back in the Comments");
action.setRedirectURL(current);
}
}

 

 

Thanks.

1 ACCEPTED SOLUTION

Johns Marokky
Tera Guru

Hi @AnandKumar1 ,

Check the below support case and see if it solves the problem.

Getting "Action not Authorized error" when Cancelling the Change Request - Support and Troubleshooti...

 

Also do check the ACL on the Change Request State field. Sometimes it might be blocking as well.

 

Mark helpful if it helps in Solving your query.

 

Regards,

Johns

View solution in original post

2 REPLIES 2

Johns Marokky
Tera Guru

Hi @AnandKumar1 ,

Check the below support case and see if it solves the problem.

Getting "Action not Authorized error" when Cancelling the Change Request - Support and Troubleshooti...

 

Also do check the ACL on the Change Request State field. Sometimes it might be blocking as well.

 

Mark helpful if it helps in Solving your query.

 

Regards,

Johns

AnandKumar1
Tera Expert

thank you Johns, referred this article and it got worked :).