Set the Request State from a Request Item workflow

billi_lumley
ServiceNow Employee
ServiceNow Employee

Is it possible to set the Request State using Run Script from a Request Item workflow?

I tried using: current.request.request_state = 'requested';

Not working...

1 ACCEPTED SOLUTION

NeilH2
Giga Guru

Run a query to access the request table and update the state

I use this all the time to set short descriptions from a request item

var req = new GlideRecord('sc_request');
req.addQuery('sys_id', current.request);
req.query();
while (req.next()) {
req.request_state = 'requested';
req.update();
}


View solution in original post

7 REPLIES 7

NeilH2
Giga Guru

Run a query to access the request table and update the state

I use this all the time to set short descriptions from a request item

var req = new GlideRecord('sc_request');
req.addQuery('sys_id', current.request);
req.query();
while (req.next()) {
req.request_state = 'requested';
req.update();
}


v75davis
Kilo Contributor

NeilH,
Where do run you query at?


In a business rule or the workflow connected to the RITM.


v75davis
Kilo Contributor

Thanks.



I will give it a try.