- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2023 03:29 AM - edited ‎04-02-2023 03:30 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2023 07:49 AM - edited ‎04-03-2023 10:48 AM
Hi @AnandKumar1 ,
Check the below support case and see if it solves the problem.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2023 07:49 AM - edited ‎04-03-2023 10:48 AM
Hi @AnandKumar1 ,
Check the below support case and see if it solves the problem.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2023 07:33 AM
thank you Johns, referred this article and it got worked :).