The CreatorCon Call for Content is officially open! Get started here.

Setting Extended Field with GlideRecord

Trevor Muhl
Kilo Sage

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

10 REPLIES 10

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.