Update parent incident work notes when child incident is updated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 08:30 AM - edited 02-04-2023 05:13 PM
Hi Experts,
I need your help experts on this requirment.
when child incident is updated then parent incident work notes should be updated.
script:
after update BR:
var childInc = new GlideRecord('childIncident');
childInc.addQuery('sys_id', current.parent_incident);
childInc.query();
if (childInc.next()) {
childInc.work_notes=current.comments.getJournalEntry(1);
childInc.update();
}
please correct me where i have mistake it's not working for me.
Thanks & Regards,
Anji.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 02:30 PM
Hi @anjaneyulubrill ,
what you are describing is not according to ITL best practice or ServiceNow best practice.
in general you should always work on the parent ticket and not the child tickets.
best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 04:35 PM
Hi Anji,
Please try this.
var parentInc = new GlideRecord('incident');
parentInc.get(current.parent_incident);
parentInc.work_notes = current.work_notes;
parentInc.update();
Please like my comment if it helps. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 10:59 PM
There is OOB BR "Update Child Incidents" written to update child work notes when parent incident update. You can refer & create it same as per your requirement.
OR
just create Before Update BR with below code snippet.
(function executeRule(current, previous /*null when async*/) {
var parentInc = new GlideRecord("incident");
parentInc.get(current.parent_incident);
parentInc.work_notes = current.work_notes.getJournalEntry(1);
parentInc.update();
})(current, previous);
If your question is solved, please close the topic by marking my answer "Accept as Solution". This will help others searching for a similar question and will remove the topic from the unsolved list.