Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Copy Worknotes from RITM to Request

Samiksha2
Mega Sage

Hi All,

 

I need to copy RITM work notes for a particular catalog item.

I am not sure what to add in the query.

Please help.

Thanks,

Sam

2 ACCEPTED SOLUTIONS

Harish KM
Kilo Patron
Kilo Patron

Hi @Samiksha2 Create a after update BR

cond: item is "your catalog"

script:

var workNotes = current.work_notes.getJournalEntry(1);
var app = new GlideRecord('sc_request');
app.addQuery('sys_id', current.request);
app.query();
if(app.next()){
app.work_notes = "workNotes Updated " +workNotes;
app.update();
}
Regards
Harish

View solution in original post

Hi @Samiksha2 the below cond works for me,

HarishKM_0-1707367843422.png

 

Regards
Harish

View solution in original post

14 REPLIES 14

@Samiksha2 :-  If I understand correctly , you want to copy work notes from request to RITM.

 So create after insert/update BR on sc_request table.  Check Advanced checkbox.

when to run condition- work notes changes

In script section use below code.

var grRITM = new GlideRecord("sc_req_item");
    grRITM.addQuery("request", current.sys_id);
    grRITM.query();
    while (grRITM.next()) {
        grRITM.work_notes = current.work_notes;
        grRITM.update();
    }

 

Hope it helps. Kindly mark helpful/ Accepted if it assists you.

Regards,

Priyanka Salunke

Harish KM
Kilo Patron
Kilo Patron

Hi @Samiksha2 Create a after update BR

cond: item is "your catalog"

script:

var workNotes = current.work_notes.getJournalEntry(1);
var app = new GlideRecord('sc_request');
app.addQuery('sys_id', current.request);
app.query();
if(app.next()){
app.work_notes = "workNotes Updated " +workNotes;
app.update();
}
Regards
Harish

Hi @Harish KM ,

Can you help me with this query- when worknote is not updated by system then only it should copied.

 

Thanks,

Sam

Hi @Samiksha2 add another condition updatedBy isNOT system, to avoid system update worknotes

Regards
Harish

Hi @Harish KM ,

It is not working