- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 06:10 AM
Hi All,
I am trying to update a reference field to empty for all records.
I tried filtering and update all on those records to make the reference field empty.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 06:14 AM
Hi Chris,
Have you tried this
gr.assigned_to = "";
Re: Updating reference fields with 'NULL'
Regards,
Harshvardhan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 06:14 AM
Hi Chris,
Have you tried this
gr.assigned_to = "";
Re: Updating reference fields with 'NULL'
Regards,
Harshvardhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 06:15 AM
you can just set that field to empty. Here is an example.
var gr = new GlideRecord('u_referencetable');
gr.query();
while(gr.next())
{
gr.u_maintableid = "";
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 06:15 AM
Chris,
What about an update via a GlideRecord?
var gr = new GlideRecord('incident');
gr.addQuery(<your conditions here>);
gr.query();
while(gr.next()){
//set opened_by to empty value
gr.opened_by = '';
gr.update()
}
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2020 08:41 PM
Thanks! Just update 7K+ records in minutes.
var grp = new GlideRecord('sys_user_group');\\table of focus
grp.addEncodedQuery('active=true^type=4b9b46ba1bb39010a4a32f0b234bcb71');\\condition. group IS active AND group TYPE is = enter type sys ID
grp.query();
while(grp.next())
{
grp.type ='';\\updates field TYPE that equals "4b9b46ba1bb39010a4a32f0b234bcb71" to null/empty
grp.update();
}
4yrs from the future i thank you again.