change the stage of a RITM manually

chiranjeevigoll
Kilo Contributor

Hi there, I have an RITM whose stage is stuck at Fulfillment due an incorrect workflow, which has been now corrected, however I have difficulty in changing the stage of the RITM from Fulfillment to Request Cancelled. Used below script but it's changing the state only in Form View. When looked at the List view, the record's stage still shows as Fulfillment. 

Copied stage value from Workflow.

 

var gr = new GlideRecord('sc_req_item');
gr.addQuery('number','RITM0123456');
gr.query();
if(gr.next()){
gr.autoSysFields(false);
gr.setWorkflow(false);
gr.stage = 'Request Cancelled';
gr.update();
}

 List View: 

find_real_file.png

Form View: 

find_real_file.png

 

Any help in this regard is really helpful. Thanks,

8 REPLIES 8

sachin_namjoshi
Kilo Patron
Kilo Patron

Please use below script to change stage of requested item 

var gr = new GlideRecord('sc_req_item');
gr.addQuery('number','RITM0123456');
gr.query();
if(gr.next()){

gr.stage = 'Request Cancelled'; // please check correct stage choice list value from your instance
gr.autoSysFields(false);
gr.setWorkflow(false);
gr.update();
}

 

find_real_file.png

 

 

Regards,

Sachin

 

We dont have the Request cancelled here in the choice list, however the other RITMs have the Request Cancelled stage which has been set from Workflow. Since this workflow has already been completed, is there a possibility to set the stage to Request Cancelled? 

Please use below to cancel RITM from background script

 

var gr = new GlideRecord('sc_req_item');
gr.addQuery('number','RITM0123456');
gr.query();
if(gr.next()){

gr.stage = 'Request Cancelled'; // please check correct stage choice list value from your instance
gr.autoSysFields(false);
gr.setWorkflow(false);
gr.update();
}

 

Regards,

Sachin

Thanks this worked for me.  Just to add to this post for inexperienced people like me.  I did this from Filter Navigator/Scripts-Background.  I copied and pasted the above text and changed the ritm number and the stage to what I needed and it worked perfectly