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

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

 

☝️ 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! */


phr
Tera Contributor

Hi @GlideFather ,

 

Thanks , this worked.

Hi @Chaitanya ILCR ,

 

Thank you. This worked.