How to copy work notes and additional comments from Child incident to parent incident?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 03:08 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 03:10 AM
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:
- When: Before 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 03:30 AM
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