Parent Child Incident Tickets Synchronization

zaxjun
Tera Contributor

I have a child and parent incident and I want to have them both synchronized especially to these 3 fields (state, priority, notes).

1 ACCEPTED SOLUTION

raja0077
Tera Expert

Hi @zaxjun ,

If you want synchonize parent and child incident means ,You need to write a business rule in Incient.

 

1.Child to Parent

      var childToParent = new GlideRecord('incident');

       if (childToParent.get(current.parent)) {

          childToParent.state = current.state;

          childToParent.priority = current.priority;

          childToParent.work_notes = current.work_notes; 

          childToParent.update();

       }

2.Parent to child

  • Incident have OOB business rule called "Update Child Incidents",In this business rule you can  add additional fields to updation from parent to child. 

     

  • raja0077_1-1696915921761.png

     

Thank you.

View solution in original post

7 REPLIES 7

Danish Bhairag2
Tera Sage
Tera Sage

Hi @zaxjun ,

 

To synchronize fields between parent and child incidents in ServiceNow, you can use Business Rules or Workflow Rules. Here's how you can achieve this using Business Rules:

 

### Using Business Rules:

 

1. **Create a Business Rule on the Child Incident Table:**

   - Navigate to "System Definition" > "Business Rules" in the application navigator.

   - Click on "New" to create a new Business Rule.

   - Configure the Business Rule to run on the child incident table.

   - Set the condition when the rule should run (for example, when state, priority, or notes fields change).

 

2. **Define the Business Rule Script:**

   - Write a script to update the corresponding fields in the parent incident based on changes in the child incident.

   - Here's an example script to synchronize `state`, `priority`, and `notes` fields:

 

   

   (function executeRule(current, previous /*null when async*/) {

       var parentIncident = new GlideRecord('incident');

       if (parentIncident.get(current.parent)) {

           parentIncident.state = current.state;

           parentIncident.priority = current.priority;

           parentIncident.work_notes = current.work_notes; // Synchronize notes field

           parentIncident.update();

       }

   })(current, previous);

   

 

   In this script, `current` represents the child incident record being updated. It checks the parent incident (`current.parent`), updates `state`, `priority`, and `work_notes` fields in the parent incident based on changes in the child incident.

 

3. **Configure the Business Rule Actions:**

   - Set the order of the Business Rule to ensure it runs after changes are made to the child incident.

   - Save the Business Rule.

 

Now, whenever the `state`, `priority`, or `work_notes` fields of the child incident change, the corresponding fields in the parent incident will be synchronized.

 

Remember to test this in a non-production environment first to ensure it works as expected in your specific ServiceNow configuration.

 

Mark my answer helpful & accepted if it helps you resolve your issue.

 

Thanks,

Danish

Hello Danish, Good day! Thanks for your answer but it's the other way around. When updating the parent incident ticket, it should cascade to its child tickets. They should not be able to update the parent by updating the child ticket.

Sandeep Joshi1
Tera Contributor

raja0077
Tera Expert

Hi @zaxjun ,

If you want synchonize parent and child incident means ,You need to write a business rule in Incient.

 

1.Child to Parent

      var childToParent = new GlideRecord('incident');

       if (childToParent.get(current.parent)) {

          childToParent.state = current.state;

          childToParent.priority = current.priority;

          childToParent.work_notes = current.work_notes; 

          childToParent.update();

       }

2.Parent to child

  • Incident have OOB business rule called "Update Child Incidents",In this business rule you can  add additional fields to updation from parent to child. 

     

  • raja0077_1-1696915921761.png

     

Thank you.