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

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Samiksha2 

 

Check this:

 

https://www.servicenow.com/community/itsm-forum/copy-work-notes-from-task-gt-ritm-and-vice-versa/td-...

 

https://www.servicenow.com/community/now-platform-articles/copy-task-comments-and-worknotes-to-paren...

 

This will give a baseline.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG ,

 

That doesn't work for Request to RITM.
I dont know what should be the query. 

var gr = new GlideRecord('sc_request');
        gr.addQuery('here');
        gr.query();
        while (gr.next()) {
            gr.comments = current.comments;
            gr.work_notes = current.work_notes;
            gr.update();
 
 
Thanks,
Sam

Hi @Dr Atul G- LNG ,

I added this query.

var grs = new GlideRecord('sc_request');
        grs.addQuery('sys_id', current.request.sys_id);
        grs.query();
        while (grs.next()) {
            //grs.comments = current.comments;
            grs.work_notes = current.work_notes;
            grs.update();
        }
What is the error here?
It is not working.
 
Thanks,
Sam

Hey @Dr Atul G- LNG ,

 

It is working now.

 

Thanks,

Sam