copy from inciden task 'close notes' to parent incident worknotes

tushar_ghadage
Tera Contributor

Hi All , 

I am trying to copy close notes from incident task (when its close complete) to parent incident record in worknotes.

 

here is the before update with condition close notes changes business rule is used: 

 

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

    // Add your code here
    var lastWorkNote = current.close_notes.getJournalEntry(-1);

    var parentInc = new GlideRecord('incident');
    parentInc.addQuery('sys_id', current.parent_incident);
    parentInc.query();

    if (parentInc.next()) {
        parentInc.work_notes = lastWorkNote;
        parentInc.update();
    }

})(current, previous);
 
but its not getting copied as expected , please help me out !!
17 REPLIES 17

Ankur Bawiskar
Tera Patron
Tera Patron

@tushar_ghadage 

script shared by @Chaitanya ILCR should work fine.

You can also use flow designer for this.

share what did you configure and what debugging did you do?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi , 

here is what i did : 

 

Screenshot (17).pngScreenshot (18).pngScreenshot (19).png

Hi @tushar_ghadage 

 

Here also your Flow logic looks fine but your flow is not Activated. You need to activate the flow before using it. You can only use TEST without Activating the Flow. 

 

If my response helped, please hit the Thumb Icon and accept the solution so that it benefits future readers.

 

Regards,
Rohit