State Flow Requirement on Incident Form

Gulfam Shafee3
Tera Expert

Hi experts,

I have a requirement related to the state flow on the incident form and would appreciate your guidance.

  • When the incident form is opened, the only available state option should be "New".
  • After submitting the form, the state should allow selecting one of the following three options: "In Progress", "On Hold", or "Cancelled".
  • If the state is changed to "In Progress", the available state options should update to "Resolved", "On Hold", or "Cancelled".
  • Once the state is set to "Resolved", the only available state option should be "Closed".

Could you please advise on how to implement this state flow using Business Rules, UI Policies, or Client Scripts?

Thank you!

4 REPLIES 4

Viraj Hudlikar
Giga Sage

Hello @Gulfam Shafee3 

You can utilize State Model module which is available under state management application menu as showed below.

VirajHudlikar_0-1738950612674.png

 

Do refer this overs docs - https://www.servicenow.com/docs/csh?topicname=prm-create-state-model-transition.html&version=latest

or check out this video - https://youtu.be/NRoMGusIHYA?si=UBpnSOLufvt-crK-

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

Thanks & Regards
Viraj Hudlikar.

Hello @Gulfam Shafee3 

Thank you for marking my response as helpful! 😊

 

I hope your concern has been fully addressed. If it resolves your issue, please consider marking it as the accepted solution. This will ensure others in the community can benefit from the solution too.

Thanks & Regards
Viraj Hudlikar.

Sujatha V M
Kilo Patron
Kilo Patron

@Gulfam Shafee3  Based on your use case, I assume its on the "State" field. If so, you may use client script to display the choices. 

 

Using an onChange client script on "Incident" table for state field and considering if its a new record or not. 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading && g_form.isNewRecord()) {
        g_form.removeOption('state', 2);
        g_form.removeOption('state', 3);
        g_form.removeOption('state', 6);
		g_form.removeOption('state', 7);
        g_form.removeOption('state', 8);
    }

    if (newValue == 2 && !g_form.isNewRecord()) {
        g_form.removeOption('state', 1);
        g_form.removeOption('state', 7);
    }
	else if(newValue == 6){
		g_form.removeOption('state', 1);
		g_form.removeOption('state', 2);
		g_form.removeOption('state', 3);
		g_form.removeOption('state', 8);

	}

}

 

When the incident form is opened, the only available state option should be "New".

 

SujathaVM_0-1738951633098.png

 

 

 

 

If the state is changed to "In Progress", the available state options should update to "Resolved", "On Hold", or "Cancelled".

 

SujathaVM_1-1738951863601.png

 

Once the state is set to "Resolved", the only available state option should be "Closed".

SujathaVM_2-1738951930554.png

 

Note: Modify the script accordingly if required. 

 

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

NehaSNOW
Tera Guru

Hi @Gulfam Shafee3 ,

 

I have achieved it at my end.

Navigate to State Management -> State Models to create the new State Model. You can create as below screenshot which is working fine at my end.

Please note that state mentioned in the Enter Condition are OOTB.

 

NehaSNOW_0-1738952623973.png

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

Thanks & Regards
Neha Pateria