Unable Change request States due to Change Model
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 07:43 AM
Hello,
Recently we changed the status bar of the Change requests to have only New, Assess, Implement, Closed and Cancelled.
Also I wrote a script to change all the change requests in 'Review' state to 'Implement' state. It gave out an message saying
operation against file 'change_request' was aborted by Business Rule 'State model - Can change state"
I have attached the image of the Change model states. Could you all please let me know, what to address in the change model, so I can remove Review and Scheduled from being the state choices and being part of the Change process.
In case you need to see the script for the change :
The script is :
var numarray = ["CHG0030060"];
for (var i = 0; i < numarray.length; i++){
var gr = new GlideRecord("change_request");
gr.addQuery('number', numarray[i]);
gr.query();
while(gr.next()){
gr.state = '-1';
//gr.setWorkflow(false);
gr.update();
}
}
Any response appreciated !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 07:48 AM
Hi @Shree Nag
You need to remove the states from State model but it may impact other state. Better create a new model and add all state excepts these 2.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************