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-11-2024 03:13 AM
Hi @Jyoti Mehta
This might be helpful
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 03:16 AM
Hi Atul,
Thanks for your reply! But we want to copy child incident comments/work notes to parent incident, not parent incident to child incident as it is already working in our instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2024 12:05 AM
Hi @Jyoti Mehta,
You can achieve this functionality by writing a Business rule to copy the comments from the child tickets to parent ticket using the below script.
Business rule when to run conditions:
advance script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var gr = new GlideRecord("incident");
gr.addQuery("sys_id", current.parent_incident.sys_id);
gr.addActiveQuery();
gr.query();
if (gr.next()) {
gr.work_notes = current.work_notes.getJournalEntry(1);
gr.update();
//gr.setWorkflow(false);
}
})(current, previous);
I have added the screenshots of test case as well for reference.
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.
Thanks and Regards,
K. Sai Charan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 03:11 AM
Hi,
Thanks for your response! I have tried this solution and it seems be working like work notes/comments are copying from Child to parent but as we have OOTB business rule from Parent to child copy comments/work notes due to which the loop is keep on going.
Do you know any way so that we can restrict the loop ? If it will only copy the comments if it is added by any user, not system generated ?