how to copy the CTASK close note to CR worknotes

VIKAS MISHRA
Tera Contributor

I want to copy the close not of CTASK to CR work notes, but the script is not working for CR works notes only.

If i use gr.description instead of gr.work_notes then it copy the Close note and past it to CR description filed, but when i am using "gr.work_notes" then it's not pasting the CTASK close notes to CR worknote, please suggest.

var gr = new GlideRecord("change_request");
	gr.addQuery("sys_id", current.change_request);
	gr.query();
	if (gr.next()) {
		gs.log('test3');
gr.work_notes = current.close_notes;
    gr.update();

}

 

1 ACCEPTED SOLUTION

J Siva
Tera Sage

Hi @VIKAS MISHRA 
Try the below script. It'll work.

 var crq = new GlideRecord("change_request");
    crq.addQuery("sys_id", current.change_request);
    crq.query();
    if (crq.next()) {
        crq.work_notes.setJournalEntry(current.close_notes);
        crq.update();

    }

Regards,
Siva

View solution in original post

1 REPLY 1

J Siva
Tera Sage

Hi @VIKAS MISHRA 
Try the below script. It'll work.

 var crq = new GlideRecord("change_request");
    crq.addQuery("sys_id", current.change_request);
    crq.query();
    if (crq.next()) {
        crq.work_notes.setJournalEntry(current.close_notes);
        crq.update();

    }

Regards,
Siva