3. Set the state to "Awaiting Change" when a Change is created from the incident using the existing "Create Normal Change" and "Create Emergency Change" UI actions.

anilkumar8
Tera Contributor

3. Set the state to "Awaiting Change" when a Change is created from the incident using the existing "Create Normal Change" and "Create Emergency Change" UI actions.

16 REPLIES 16

Mounika30
Kilo Sage

Hi, it is not working for me

I have created a choice field-"Awaiting change" in the "state" in the incident.

how to achieve this

 

An incident should be in a (new) state of Awaiting Change when a change record has been created from the incident record. Agents should not be able to select On Hold.
Hint: Do not delete existing state choices!
Tip: Be sure to use 'state' and not 'incident state'!

1. Disable the State choice: "On Hold".

2. Add a new State choice with the Label of: "Awaiting Change", in the sys_choice record make the Value field: 4.

3. Set the state on the incident record to "Awaiting Change" when a Change is created from an incident, by updating the existing "Create Normal Change" and "Create Emergency Change" UI actions.

can anyone explain in detail?

 

Hi,

Here’s how you can achieve this:

  1. Disable the "On Hold" State Choice:

    • Navigate to the "On Hold" choice in the "State" field and set the "Inactive" field to true.
  2. Add the "Awaiting Change" State Choice:

    • You mentioned you have already created the "Awaiting Change" state. Ensure you have set the Value field to 4 in the sys_choice record.
  3. Update the UI Actions:

    • To set the state on the incident record to "Awaiting Change" when a change is created from an incident, you need to update the "Create Normal Change" and "Create Emergency Change" UI actions.

    • Insert the following code just after the line

      changeRequest.insert();
       

 

 

changeRequest.setValue("state", 4);
current.update();

 

 

  • Note: Replace 4 with the actual value you set for "Awaiting Change" if it's different.

Here’s a detailed step-by-step guide for updating the UI actions:

  1. Go to the UI Actions section in the ServiceNow instance.
  2. Find and open the "Create Normal Change" UI action.
  3. Locate the line
    changeRequest.insert();
  4. Directly after this line, insert:
     

 

 

changeRequest.setValue("state", 4); // Replace 4 with your actual value 
current.update();

 

 

  • Repeat the same for the "Create Emergency Change" UI action.

This should ensure that the incident state is updated to "Awaiting Change" whenever a change record is created from an incident.

Hope this helps!

ICaTonyBalde_2-1722270273001.pngICaTonyBalde_3-1722270292909.png