How do I cancel an incident after a Request has been created from it?

TALENAJ
Tera Contributor

In our instance, we only have technicians creating Requests (users can create Incidents). We will create Requests from Incidents. I have tried creating a Business Rule to cancel the Incident after the Request has been made and I'm running into a couple issues. 

 

Here is the script I'm using: 
(function executeRule(current, previous /*null when async*/) {
// Ensure the request has a valid parent Incident
var grIncident = new GlideRecord('incident');
if (grIncident.get(current.parent)) {
// Update the incident state to Cancelled (typically 😎
grIncident.incident_state = 8;

// Populate required cancellation fields (verify exact choices for your instance)
grIncident.close_code = 'Service Request Created';
grIncident.close_notes = 'Incident canceled due to automatic Request creation: ' + current.number;

grIncident.update();
}
})(current, previous);

 

This instructions I see ask me to use the following conditions:
Configure the Filter Conditions:

  • Parent (or Request for) is not empty
  • Parent.sys_class_name is incident (ensures it only runs when the request is generated from an incident) 

Please help me figure out how to configure parent.sys_class_name

I do not have that option in my settings (see screenshot). I don't see it as a filter, clause or role condition. 

1 ACCEPTED SOLUTION

Dinesh Chilaka
Kilo Sage

Hi @TALENAJ ,

You can check the condition in the Advanced tab, as shown in the image below.Screenshot 2026-06-16 at 10.35.24 PM.png

current.parent.sys_class_name=='incident'

 

If my response helped, mark it as helpful and accept the solution.

 

Thanks,

Dinesh

View solution in original post

2 REPLIES 2

Dinesh Chilaka
Kilo Sage

Hi @TALENAJ ,

You can check the condition in the Advanced tab, as shown in the image below.Screenshot 2026-06-16 at 10.35.24 PM.png

current.parent.sys_class_name=='incident'

 

If my response helped, mark it as helpful and accept the solution.

 

Thanks,

Dinesh

Tanushree Maiti
Tera Patron

Hi @TALENAJ 

 

Update the existing Active UI Action "Create Request" on Incident

 

 

  1. Navigate to System Definition > UI Actions and find the existing UI Action used to create Requests
  2. Add the following Script to your UI Action script, ensuring it updates the incident state and closure fields before updating the record:

 

current.state = 8;

current.close_code = 'Service Request Created';

current.close_notes = 'Incident cancelled as it was converted to a Request.';

current.update();

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti