- 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 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:11 AM
☝️ this works, I guess due to:
gr.setUseEngines(false);
/* 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:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:19 AM