Manually change stage of a requested item

leahp
Kilo Guru

I have a workflow that, upon ending, didn't change the Stage of the Requested Item.   We have corrected the workflow, but I have several Requested Items that are actually complete but the stage is still Fulfillment.   Is there a way to manually change the value on these entries?

11 REPLIES 11

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Leah,



You can run a background script to manually update those records. However background scripts are powerful so please try the script on dev first.


Background Scripts — ServiceNow Elite


http://wiki.servicenow.com/?title=GlideRecord#gsc.tab=0


Chuck Tomasi
Tera Patron

Hi Leah,



That script would look something like this. Hopefully you don't have too many to do manually. I would avoid using a loop to update these as it could update too many of them.



var id = '(some sys_id of a request item record)';


var item = new GlideRecord('sc_req_item');


if (item.get(id)) {


item.stage = 'complete'; // Or appropriate value based on your stage definition


item.update();


}



If you want to avoid sending email after the fact, insert a line: item.setWorkflow(false); before the item.update() line.


OH! And TEST on a non-prod system first please.


To add to the script Chuck shared.


Use item.setWorkflow(false); before item.update(); in case you don't want to trigger business rule/notification to be fired when the ticket is updated from background script.