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 03:16 PM
Yes, this will work.
I am performing an update with the task GlideRecord as the client does not know or care about which task type they are updating (via web request). Using this method requires two read/update database operations, which I would like to avoid. I may have to get creative with a before-update business rule.