Issue
- For the request item, there's a workflow attached to it.
- IF activity and APPROVAL activity won't work as it stuck at the approval activity.
Cause
- There is a run script activity named 'Run Script' after the begin activity that has the code:
current.u_request_title = current.variables.Require_Access; - Now in the Approval activity, we are querying using the same field 'u_request_title'
Resolution
- There is a run script activity named 'Run Script' after the begin activity that has the code:
current.u_request_title = current.variables.Require_Access; - Now in the Approval activity, we are querying using the same field 'u_request_title' :
var mgrAppr = new GlideRecord('u_service_request_lookup');
mgrAppr.addQuery('u_request_title', current.u_request_title);
mgrAppr.query();
if(mgrAppr.next()) {
apprRequired = mgrAppr.u_manager_approval_required;
}
gs.log('Line Manager:- ' + current.u_request_title + ' isreq = ' + apprRequired);
- For the RITM0080601, there is no variable named "Require_Access" and therefore the gliderecord query to the "u_service_request_lookup" table would have searched for 'u_request_title' IS EMPTY and it would not return any result and therefore the value for 'apprRequired' variable is 'False'.
- We can confirm this by looking at the system log from the approval activity:
Line Manager:- isreq = false - We can see that the 'current.u_request_title' is empty as the workflow tries to set the empty value.
The world works with ServiceNow.