
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 05:17 AM
Within Incident Management, we turned the state of "Awaiting User Info" (created, not OTB state) to Inactive status. There were over 400 tickets that were in that state, most of which were over 1 year old (put in that state by technician, then "forgotten")
We were able to get a Fix Script on this site that would convert all of those tickets from the old, inactive state to the Closed state so no emails would go out to the callers.
This worked just fine in our Development instance, so we cloned down our Production Instance to our Test Instance and ran the Fix Script in that instance.
However, the results were inaccurate this time. Instead of converting them to Closed state, they were convert to Canceled state. There are no emails turned on for this instance so no callers received emails, but need to know why that happened?
The state values in both Development and Test instances are identical, so I made no changes to the fix script. I did export the tickets just in case and nothing has been done in Production unless this can be fixed.
Attached is document showing screen shots of both Instances State choice list and the Fix Script.
I appreciate all the help I can get. I did have a HI ticket open and while they told me they couldn't furnish me a script, they did send me the Community link with the one I used.
Thanks!
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 07:41 AM
Can you try enclosing it in a function and calling it.
please put your sys_id fileter to update only one.
Also note it is gr.setWorkflow(false) not gs.
UpdateIncidentState();
function UpdateIncidentState(){
var gr = new GlideRecord('incident');
gr.addQuery('state',9);
gr.query();
while(gr.next()){
gr.setWorkflow(false);
gr.state = 7;
gr.update();
}
}
Vinod Kumar Kachineni
Community Rising Star 2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2019 10:37 AM
i ran this fix script last Saturday (8/24) after running it in our Test instance (which is now clone of our production as of 8/9/19) and while it converted all 472 tickets to closed state, for some reason, 12 of those tickets are still appearing if you set the filter to "Active is true".
Is there some way this can be fixed? It's affecting reporting that is setup to return all tickets in states where Active is True which is normally not a ticket with the state of Closed.
In screen shot below is what I got using the filter of "Active is true" and "State is Closed". As you can see, while these were previously in the inactive state of "Awaiting User Info", there are two on there that were created as recent as 6/13/19.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2019 10:55 AM
You can set the active flag to false in the script.
UpdateIncidentState();
function UpdateIncidentState(){
var gr = new GlideRecord('incident');
gr.addQuery('state',9);
gr.query();
while(gr.next()){
gr.setWorkflow(false);
gr.state = 7;
gr.active = false; //also set the active flag to false
gr.update();
}
}
Vinod Kumar Kachineni
Community Rising Star 2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 11:14 AM
The issue here is you are using
gs.setWorkflow(false);
instead of
gr.setWorkflow(false);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 12:35 PM
That was fixed in the like third version of original script, however it did change state to Closed but did not populate the ticket with the change in either History or Activity Stream
I even tried the other script with vkachineni's suggestion of removing the gr.setWorfklow(false); but that made it go back to Canceled state instead of Closed.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 12:43 PM
Terri,
you will have to find the BR that is changing the state to cancelled and make it inactive.
Run your script
Mark the BR back to active.
That way you will have the history on the incident and also changed to Closed.
Vinod Kumar Kachineni
Community Rising Star 2022