Moving the Incident Status to Next State using UI action.

guptaneetika
Kilo Contributor

Hello ,

I am new to ServiceNow.

The requirement is to hide the State field of Incident form and use UI Action to move the Status to next Stage.

As per my understanding, We need to select Onclick checkbox of UI Action and use that function in building theScript.

How to write a Script in this case.

Please help.,

Regards,

Neetika

2 REPLIES 2

anishsrigiri
Kilo Expert

Hi Neethika Guptha,



        Create a form button using the ui action, where the condition should be "current.incident_state = 1;" and in the script


Onclick: updateState()// which calls the function.



Script:


function updateState(){


  current.incident_state = 2;// mention the value of the state which you want to update


  current.update();


}



Create as many buttons based on the condition you can manage to get it displayed on the form.



Thanks,


Anish.



Please click on helpful, if this works for you.


Kalaiarasan Pus
Giga Sage

Having buttons for each state may be appealing to the user initially but overtime, it becomes unmanageable and cumbersome overtime as more buttons get added.



I would advise you to revisit the design if possible and make state field editable and mandatory. Additionally, you can also show only the correct states on certain stages instead of all the possible state choices.