How to copy work notes and additional comments from Child incident to parent incident?

Jyoti Mehta
Tera Contributor

Hi Everyone,

we have a requirement where work notes and additional comments changes on child incident should be copied to parent incident also. 

can you please help us to achieve this ?

Thanks in advance!

6 REPLIES 6

Deepak Shaerma
Kilo Sage

Hello @Jyoti Mehta 

To copy work notes and additional comments from a child incident to a parent incident in ServiceNow, you typically need to create a Business Rule. Please follow below steps:

1. New Business Rule: Click on “New” to create a new business rule.

2. Define Basic Information:
Name: Give the business rule a descriptive name, e.g., “Copy Notes from Child to Parent Incident”.
Table: Set this to “Incident [incident]” as you’re working with incidents.
Advanced: Check this box because you’ll be writing a script.

3. When to Run:
WhenBefore Inserted/Updated
Filter Conditions: “Parent Incident” field is not empty.
Script: Enter your custom script here.

// Ensure there is a parent incident
    if (current.parent_incident.nil()) {
        return;
    }
    
    var parentInc = new GlideRecord('incident');
    if (parentInc.get(current.parent_incident)) {
        
        // Concatenate current comments and work notes to the parent incident
        // Assuming ‘comments’ and ‘work_notes’ are the fields for additional comments and work notes, respectively
        
        if (!current.comments.nil()) {
            parentInc.comments = "Child Incident Update: " + current.comments + "\n\n" + parentInc.comments;
        }
        
        if (!current.work_notes.nil()) {
            parentInc.work_notes = "Child Incident Update (Work Note): " + current.work_notes + "\n\n" + parentInc.work_notes;
        }
        
        parentInc.update();
    }


Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help us a lot.
Thanks & Regards 
Deepak Sharma

Deepak Shaerma
Kilo Sage

Hi @Jyoti Mehta 
check with this approach 
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help us a lot.
Thanks & Regards 
Deepak Sharma