Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

User wants INC reopened

Mohammed Asad
Tera Contributor

User has reported "I have tried keep the ticket (INC123456) in pending when I update the ticket with pending notes but the ticket was showing closed cancel." I believe they want the INC reopening, can anyone tell what background script I have to use, the script needs to be active=true, i will be running that through incident that is closed/cancelled

Thanks.

2 REPLIES 2

Dr Atul G- LNG
Tera Patron

Hi @Mohammed Asad 

 

It is not a best practice to reopen any closed / cancelled Incident , even will not recommend to do via script.

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

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

Deepak Shaerma
Mega Sage

Hi @Mohammed Asad 
I also agreed with @Dr Atul G- LNG sir, its not a best practice to reopen any closed / cancelled Incident , even will not recommend to do via script.

Still i`m providing the background script for the same: 

var incidentGR = new GlideRecord('incident');
if (incidentGR.get('7163723a4755c2102ab9d44a516d4362')) { // Replace your_sys_id_here with the actual sys_id
    incidentGR.setValue('state', 2); // Assuming 4 is Pending, replace with correct value if different
    incidentGR.setValue('active', true); // Reactivate the incident
    incidentGR.update();
    gs.info('Incident ' + incidentGR.number + ' updated successfully');
} else {
    gs.error('Incident not found');
}

Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards 
Deepak Sharma