Incident state lifecycle

Mimi Edet
Tera Guru

MimiEdet_0-1728017766900.png

As the Incident Manager, I want Incidents to follow the flow/lifecycle as outlined in the attached diagram. I will know this is complete when an Incident's state follows the provided diagram.
 
PLease how do I achieve this?
2 ACCEPTED SOLUTIONS

gtalreja
ServiceNow Employee

@Mimi Edet , you can achieve this without doing any scripting, and in a ServiceNow-recommended way using a state model flow. it is very easy to configure, here is a document around it that may be of some help, but let me know if you get stuck in configuring this I can guide you.

All > State Management > State Models (this is the starting point for the configuration)

Life cycle of an Incident

View solution in original post

gtalreja
ServiceNow Employee

Yes, indeed, I just tried it in my instance, you would need four state models for it, I'm attaching the screenshots of same.Screenshot 2024-10-06 at 8.44.12 PM.pngScreenshot 2024-10-06 at 8.44.19 PM.pngScreenshot 2024-10-06 at 8.44.24 PM.pngScreenshot 2024-10-06 at 8.44.32 PM.png

View solution in original post

8 REPLIES 8

Pradeep Thipani
Mega Sage

Hi @Mimi Edet ,

 

If you want to show state dropdowns you can achieve this by writing a onLoad Client script. Give the conditions on the respective button to be visible on the form.

example for client script, you can modify based on your need:

 

function onLoad() {
	var incState = g_form.getValue('state');					//getting state value of current from
    if (g_form.isNewRecord() && incState == '1') {				//checking the record is new or not
		g_form.setReadOnly('state', true);						//making state field readonly
    }
	
	else if(incState == '5'){									//checking the state value is assigned or not
		g_form.removeOption('state','1');						//removing "New" option from state
		g_form.removeOption('state','3');						//removed "On Hold" option from state
		g_form.removeOption('state','6');						//removed "Resolved" option from state
		g_form.removeOption('state','7');						//removed "Closed" option from state
		g_form.removeOption('state','8');						//removed "Canceled" option from state
	}
	else if(incState == '2'){									//checking the state value is "In progress" or not
		g_form.removeOption('state','1');						//removed "New" option from state
		//g_form.removeOption('state','5');						//removed "Assigned" option from state
		g_form.removeOption('state','7');						//removed "Closed" option from state
		g_form.removeOption('state','8'); 						//removed "Canceled" option from state
	}
	else if(incState == '3'){									//checking the state value is "On Hold' or not
		g_form.removeOption('state','1');						//removing "New" option from state
		g_form.removeOption('state','5');						//removed "Assigned" option from state
		g_form.removeOption('state','6');						//removed "Resolved" option from state
		g_form.removeOption('state','7');						//removed "Closed" option from state
		g_form.removeOption('state','8'); 						//removed "Canceled" option from state
	}

}

 

Mimi Edet
Tera Guru

Can I use this script in Business rule?

Hi @Mimi Edet 

 

You have to write client script, the below example is for onload catalog client script.

 

 

Thanks,

Pradeep

Pradeep Thipani
Mega Sage

Hi @Mimi Edet ,

 

If my solution helps you please accept the solution and close the thread.

 

Thanks,

Pradeep