UI Action Condition and Incident State

kevinthury
Tera Guru

we are looking to create a new Incident State (Pending Resolution) and have specific Incident Form buttons appear/disappear in the event of this state.   I created a new UI Action and utilized similar conditions that I know work.   ie. current.incident_state != IncidentState.CLOSED && current.incident_state != IncidentState.RESOLVED

Attempts to plug in the new State failed to work.   This condition did not recognize the new State I had created.   After some more digging, I found the Incident State values are determined by an OOTB Script Includes:   IncidentState & IncidentStateSNC.   I copid both of these Script Includes and updated to include our new State. (See image below with new state at Line 7) I was then able to successfully incorporate this into the UI Action condition and achieve desired results.

I have this sneaky suspicion that I am making this more difficult than it needs to be.   Do you know of a way to simplify this process of restricting the UI Action form button based on State without the need for the expression of 'current.incident_state != IncidentState.RESOLVED'?  

find_real_file.png

2 REPLIES 2

Aditya Mallik
ServiceNow Employee
ServiceNow Employee

Can you send a screen shot of the Incident State choice list configuration?


What was the original condition that you had written on the UI Condition definition, that did not work for you?



Also, please note that there are two state fields on the Incident table. One is "state" and the other is "incident_state". Just ensure that what ever choices you have added to incident_state field are added to state field as well.



Check the form layout to confirm, if you are displaying state or incident_state in your form.


Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi Kevin,



If I was going to have multiple "resolve" states I would go like the "On Hold". Make a sub-state for resolve. Se the default value for what most of the cases people use and then   give the ability to change it if needed. Then you can make a ui action to check if the state is resolve and the sub state is correct as well.