
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2020 01:39 AM
Good Morning,
Please can someone advise... i need a background script to force two CHG records to the state Implement. We have discovered a fault within the change workflow and whilst we get that sorted.. we need to manually force a couple of changes to "implement" so we can proceed with them.
Advise/the script we need to run... would be much appreciated.
As you can see.. i am unable to change the state from the list view (or the form view)
thanks again!
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2020 01:56 AM
Hi,
As per OOB normal change state model , change can we move from authorize to schedule/cancel states only. .
See 'ChangeRequestStateModel_normal' script include.
So, you need use setWorkflow to false before running the script in backgroud or else business rule will stop doing that. Try below script:
var gr= new GlideRecord('change_request');
gr.addEncodedQuery("numberINCHG0030712,CHG0030714");
gr.query();
while(gr.next()){
gr.setWorkflow(false); //prevent running business rule
gr.state='-1';//implement state
gr.update();
}
Hope this helps!
If I have answered your question, please mark my response as correct and/or helpful.
Thanks,
Suseela P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2020 02:21 AM
Glad that you got the approach.
Did you mistakenly mark other answer as correct?
As I see same/similar script was provided before from my end.
Please mark appropriate reply as correct and helpful to help others with the same response find the answer more quickly.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader