- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 07:48 AM
The requirement is to change the state of the problem record from 'closed" to "assess".
On writing the fix script, i see that the state is still in "closed" state .
How to fix the issue as my below code didn't work?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 07:59 AM
Hi @phr ,
try this
var gr = new GlideRecord("problem");
gr.addQuery("numberSTARTSWITHPRB0000055");
gr.query();
while (gr.next()) {
gs.info('record exist ' + gr.getValue('number'));
gr.state = 102; //As per the backend value of the state
gr.active = true;
gr.setUseEngines(false);
gr.setWorkflow(false);
gr.update();
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:16 AM
Hello @phr, Closed is considered a final state and state model takes care of not allowing to move it back. and we should avoid this. for testing purpose, you can include following line in your script and try
gr.setUseEngines(false);
Regards,
Nishant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:00 AM - edited 07-17-2025 08:02 AM
Hi,
check on your State Flows as it is "map" from what state you can go to another state.
For example you cannot go from New to Close, you need to go state by state to Resolve and then Complete to Close...
And OOTB Closed records shall be uneditable...
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:06 AM
Hi @phr
I just tried your script in the background script.
It worked.
Note: it's not best practice to move the closed problem to assess state.
var gr = new GlideRecord("problem");
gr.addQuery("numberSTARTSWITHPRB0000055");
gr.query();
if (gr.next()) {
gr.state = 102; //As per the backend value of the state
gr.active = true;
gr.setWorkflow(false);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:16 AM
Hello @phr, Closed is considered a final state and state model takes care of not allowing to move it back. and we should avoid this. for testing purpose, you can include following line in your script and try
gr.setUseEngines(false);
Regards,
Nishant