How to Update work notes using the fix script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 03:43 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 03:53 AM
Hi @Prathamesh Cha1
Please try the below code and see if it works 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.setValue("work_notes", "A VP left organization, i.e.,'Erika Sanchez', A new VP replaced the user, i.e., 'Alexis Sowa'");
gr.updateMultiple();
}
Please mark my solution as Helpful and Accepted, if it works for you in any way!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 09:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 09:46 PM
@Prathamesh Cha1, I think you can use gr.update() instead of gr.updateMultiple() because we are using while loop.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 04:05 AM
hi @Prathamesh Cha1 ,
Instead of using setValue to update worknotes , use dot-walking like below
gr.work_notes = "abc"
Since work notes is a journal fields , setValue might not work on those fields.