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

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Jyoti Mehta 

 

This might be helpful

 

https://www.servicenow.com/community/developer-forum/update-child-incident-worknotes-and-comments/m-...

*************************************************************************************************************
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]

****************************************************************************************************************

Jyoti Mehta
Tera Contributor

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. 

Sai_Charan_K
Kilo Sage

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:

Charan27_0-1710571870714.png

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

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 ?