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

Allen Andreas
Administrator
Administrator

Hi,

Please follow instructions from documentation: https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/administer/workflow-administrati...

 

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thank you Allen for the suggestion. Please note that the Workflow has been already completed, the initial workflow was missing the Complete Stage, which has been later corrected. Now, All I want do is to force update the RITM stage so that it wont appear in the active RITM's report. Thanks again.

When you follow the instructions from the documentation, does the RITM show there as "Executing". You're saying that it's complete (cancelled? but complete none the less)...but the stage isn't accurately reflecting what you manually changed it to (via script). Just the form shows request cancelled, but not the workflow stage.

So with that, I would imagine that it's still open and executing. If you go to Active Contexts and search for it, you should see it there. You can change it there to request cancelled and see if that works or click the Nudge button, which will try to bump a hung workflow to finish.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thank you Allen, There are no active workflow contexts for this RITM.