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.

How to Update work notes using the fix script

Prathamesh Cha1
Tera Contributor

Hi Team,

 

I am trying to update the assigned to and with that I also want to update work notes, I tried following code but not working

 

var gr = new GlideRecord("sn_grc_issue");
gr.addEncodedQuery("assigned_to=65bfc314c3150e90765133001501311b");
gr.query();
gr.setValue("assigned_to", "59e619a2c3ad821cd0cd747dc0013148");
gr.setValue("work_notes","A VP left organization, i.e.,'Erika Sanchez', A new VP replaced the user, i.e., 'Alexis Sowa'");
gr.updateMultiple();
 
also tried gr.work_notes.setJournalEntry("")
but didn't work.
 
Please anyone can help me in this?
Thanks
9 REPLIES 9

Hi @GouthamAnumolu ,

 

No its not working already tried.

GouthamAnumolu
ServiceNow Employee
ServiceNow Employee

hi @Prathamesh Cha1  , can you send the updated code once ?

Simon Christens
Kilo Sage

Try using gr.update() instead of gr.updateMultiple() because you are inside the while loop when you update.
gr.work_notes = 'zyx' should work

GouthamAnumolu
ServiceNow Employee
ServiceNow Employee

@Prathamesh Cha1  this should work for you

 

var gr = new GlideRecord("sn_grc_issue");
gr.addEncodedQuery("assigned_to=65bfc314c3150e90765133001501311b");
gr.query();
while(gr.next()) {
gr.setValue("assigned_to""59e619a2c3ad821cd0cd747dc0013148");
gr.work_notes ="A VP left organization, i.e.,Erika Sanchez, A new VP replaced the user, i.e., Alexis Sowa";
gr.update();
}

GouthamAnumolu
ServiceNow Employee
ServiceNow Employee

@Prathamesh Cha1 use above code , i just tested on my instance , it should work for you.