- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 04:25 AM
Hello guys,
There are more than 500 records in a table. Based on Assigned to field's value I want to update User ID field for all those. So in scripts background I have written like this but no success.
var gr = new GlideRecord('table_name');
gr.addEncodedQuery(',,,,,,,,,');
gr.query();
while(gr.next()){
gr.u_user_id = gr.assigned_to.user_name;
}
Please help here
Regards,
Sravanthi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 04:40 AM
Hi Sravanthi,
In the while loop, you will need to do gr.update() for each of those records. So like:
while(gr.next()){
gr.u_user_id = gr.assigned_to.user_name;
gr.update()
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 04:40 AM
Hi Sravanthi,
In the while loop, you will need to do gr.update() for each of those records. So like:
while(gr.next()){
gr.u_user_id = gr.assigned_to.user_name;
gr.update()
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2022 03:34 AM
Thanks Mike. Happy Weekend 🙂
Regards,
Sravanthi