Setting Extended Field with GlideRecord
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 02:30 PM
Hello all,
I have found multiple discussions that describe how to get a field value from an extended table. However, none address how to set that same field value. Unfortunately, the following background script does not update the incident "close code" as I expect:
var incidentSysId = '0bd390a4138b8700834fbda12244b056';
var taskGr = new GlideRecord('task');
taskGr.get(incidentSysId);
gs.print(taskGr.ref_incident.close_code);
taskGr.ref_incident.close_code = 'Solved (Work Around)';
taskGr.update();
Is there any method to do so with a 'task' GlideRecord? Am I required to do this using an 'incident' GlideRecord? Thank you for your time.
- Trevor Muhl
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 02:45 PM
IF you're in global scope you want to use the method, updateWithReferences();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 02:50 PM
Hello Jace,
Thank you for your response. Unfortunately, I am trying to update a field on an extended table, not a field on a referenced table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 02:54 PM
My mistake. You'll have to GlideRecord to the proper class then. You could do a quick get for the sys_class_name, then do another get to the proper class to set proper field for the extended table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 03:00 PM
I was concerned this might be the case.