How can I move an Incident to from Closed state to Cancel state

Chhavi Dixit
Tera Contributor

Hi Everyone,

 

Greetings for the day!

 

How can I move an Incident to from Closed state to Cancel state.
I am trying to do this via Fix script, its throwing a message 'Invalid state transition'.

 

Can you please help me with the script.

 

Best Regards,

Chhavi Agnihotri

9 REPLIES 9

SANDEEP28
Mega Sage

@Chhavi Dixit I tried for one incident in PDI and it worked. Below is the script

 

var incidentGr = new GlideRecord('incident');
if (incidentGr.get('470af5afa9fe198101b324dd773ef379')){ // replace your incident sys_id here
	incidentGr.setValue('state', 8);
        incidentGr.setWorkflow(false);
	incidentGr.update();
}

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

Hi @SANDEEP28 

 

Do you think it's a best practice to move an incident from 'Closed' to 'Cancelled'?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG , I understand that updating state from Closed to Cancelled is not a best practice. However, we have received a request from the client to proceed with this transition.

 

As we cannot hard delete the record in prod instance directly. 

 

Could you please advise how we can handle this?

Hi @Chhavi Dixit 

You are a ServiceNow expert, and if you don’t push back on these kinds of requests from the client, it’s not ideal. You need to clearly inform the client that it’s not possible and also not recommended, as it can have a direct impact on KPIs.

Also, if you cancel the incident, an email might be triggered to the user immediately. This could lead to confusion or even panic.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************