Reputation: 3
I would like to set the state to "Awaiting Change" when a Change is created from the incident using "Create Normal Change" or "Create Emergency Change" UI action.
Upvotes: 0
Views: 3326
Reputation: 1
Here’s how you can achieve this:
Navigate to the "On Hold" choice in the "State" field and set the "Inactive" field to true.
You mentioned you have already created the "Awaiting Change" state. Ensure you have set the Value field to 4 in the sys_choice record.
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:
Go to the UI Actions section in the ServiceNow instance.
Find and open the "Create Normal Change" UI action.
Locate the line:
List item
changeRequest.insert();
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!
Upvotes: 0
Reputation: 16255
When you create a change from either of those UI Actions, the Change Request field is populated with a reference to the one that was generated.
You can create a Business Rule for this that triggers when this happens. You can change the State once the Change Request field changes.
Name: Change Created
Table: Incident
When to run
Update: checked
Filter Conditions:
Actions
Set field values
Something like this
Upvotes: 0