Request State stuck in Awaiting Approval.

Mike Insley
Kilo Expert

Hi,

I've an issue with Request states and stages for a customer I'm supporting. When raising a request using a workflow-driven catalog item, the RITM states and stages change as you would expect, however the REQ states and states remain at their initial values (i.e request_state does not move away from Pending Approval, even after the associated RITMs are closed.) With all RITMs closed, only the state field on the REQ changes to 'Closed Complete' - I suspect that is because that field is on Task as opposed to sc_request.

I've tried, unsuccessfully, setting the REQ states in the workflow using a Set Values activity, and also the following Run Script (the workflow is on sc_req_item)

var grReq = new GlideRecord('sc_request');

grReq.get('sys_id' , current.request);

while(grReq.next()) {

grReq.request_state = "Work in progress";

gr_Req.state = '2'; //work in progress

gr_stage = 'fulfillment';

grReq.update();

}

I have also noticed that in the REQ's associated RITM's, the request display value is not appearing in the 'request' field, it displays as: find_real_file.png

As you can see, there is a record associated as the info icon is present, clicking on that will take you to the REQ.

I have noticed in the customers test instance the 'Data Lookup and Record Matching Support for Service Catalog' plugin is inactive. It's active on my personal instance, where I don't have this issue. Could this be the cause of the problem?

Thanks

Mike

1 ACCEPTED SOLUTION

Kannan Nadar
Tera Guru

Hi Mike,



When you click on the i icon does it takes you to the request page? Also your script is not correct. Try using the below.



var grReq = new GlideRecord('sc_request');


grReq.addQuery('sys_id' , current.request);


grReq.query();


while(grReq.next()) {


grReq.request_state = "Work in progress";


grReq.state = '2'; //work in progress


grReq.stage = 'fulfillment';


grReq.update();


}


View solution in original post

2 REPLIES 2

Kannan Nadar
Tera Guru

Hi Mike,



When you click on the i icon does it takes you to the request page? Also your script is not correct. Try using the below.



var grReq = new GlideRecord('sc_request');


grReq.addQuery('sys_id' , current.request);


grReq.query();


while(grReq.next()) {


grReq.request_state = "Work in progress";


grReq.state = '2'; //work in progress


grReq.stage = 'fulfillment';


grReq.update();


}


Hi Kannan.



I resolved the issue with the request field not showing the display value - someone had changed the display field on sc_request.



Thanks for help with the script, i'd missing the rogue underscores, and hadn't thought to use addQuery() instead of get(). I've tried a simplified version, just to move on request_state using the following as a run script in a workflow. the run script is the 2nd activity, after an approval action to set the request item to approved as there's no approval requirement for this item. The request_state field won't change when specifying the "Work in Progress" choice, it does however work with 'in_progress'. The difference seems to be that the 'in_progress' choice is Out of the box, while "Work in progress" isn't.



var grReq = new GlideRecord('sc_request');


grReq.addQuery('sys_id' , current.request);


grReq.query();


while(grReq.next()) {


grReq.request_state = "in_progress";


grReq.update();


}