I need to copy comments (Additional comments) from incident task record to its Parent Incident record? Any script ?

scottyharris
Kilo Contributor

I need to copy comments (Additional comments) from incident task record to its Parent Incident record? Any script ?

4 REPLIES 4

Gaurav Bajaj
Kilo Sage

I am afraid you will have to query sys_journal_field table and get the additional comments based on the element Id (which is sys Id of the task record).


Just loop through them and start adding them to your incident table.






find_real_file.png


Chuck Tomasi
Tera Patron

Hi Scotty,



It really depends WHEN you want to copy the comments. if you wish to do this when the child incident is saved, then an AFTER business rule like the following would work. Note this is untested...



(function executeRule(current, previous /*null when async*/) {



        var parent = new GlideRecord('incident');


        if (parent.get(current.getValue('parent')) {


                  parent.comments = current.comments.getJournalEntry(1);


                  parent.update();


        }



})(current, previous);


Hi Chuck,

Appreciate this was written a long time ago. Any idea how I would get the Task ID included in this update? At the minute its displaying the comments that have been added but there is no reference as to where it has come from. Any help would be great.

Thanks.

Chandu Telu
Tera Guru
Tera Guru

HI Scotty,



Please find the below link it may help you


Copy Project task comments/work notes to parent project



Please provide your feedback appropriately (Like, Helpful, Endorse AND/OR Correct) to help community.