Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

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
Kilo Patron

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
Kilo Patron

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