Not able to change the state of the problem record from 'closed" to "assess"

phr
Tera Contributor

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?

 

var gr=new GlideRecord("problem");
gr.addQuery("numberSTARTSWITHPRB0000055");
gr.query();
while(gr.next()){
gr.state=102; //As per the backend value of the state
gr.active=true;
gr.setWorkflow(false);
gr.update();
}
2 ACCEPTED SOLUTIONS

Chaitanya ILCR
Kilo Patron

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

 

View solution in original post

Nishant8
Giga Sage

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

View solution in original post

13 REPLIES 13

@GlideFather @Chaitanya ILCR 

Just a query .

My instance is on Yokohama..

Problem model is enabled.

Without using setUseEngines(false) I was able to move the state from closed to assess..

Any idea how it works?

My PDI:

Build name: Xanadu
Build date: 03-06-2025_0935
Build tag: glide-xanadu-07-02-2024__patch7-02-27-2025

and it needed the setUseEngines(false) 🤷🏻‍♀️

 

I also tried using SNUtils, double click on the field name and inserted "102"... it changed the state to RCA but the state bar in the top was showing Asses 😄 

 

KamilT_0-1752766366254.png

 

Very weird...

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Hi @J Siva ,

may be the problem record you have picked up

is having model value

ChaitanyaILCR_0-1752766507301.png

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

@phr yeah. It has prb_model value 

Peter Bodelier
Giga Sage

Hi @phr,

Probably the state model is preventing the transition of the state.
(https://instance_name.service-now.com/nav_to.do?uri=sys_state_model.do?sys_id=df73699a3b031300ad3cc9...)

You could temporarily disable it, in order to make the state change possible.
A better solution would be to simply create a new problem.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.