GlideRecord updateWithReferences and insertWithReferences

Update a record and referenced fields in one operation.

gliderecord gliderecordinsertupdatewithreferences Updated: 2026-01-27

Sometimes you want to update referenced fields while saving the base record.

updateWithReferences()

var inc = new GlideRecord('incident');
inc.get(sys_id); //Get incident record based on the sys_id
inc.caller_id.first_name = 'Jesper';
inc.caller_id.email = 'jesper@not-a-real-email.com';
inc.updateWithReferences();

insertWithReferences()

var inc = new GlideRecord('incident');
inc.initialize();
inc.short_description = 'My printer is broken';
inc.caller_id.setDisplayValue('Jesper Testuser'); //Without this, a new user could be created
inc.caller_id.first_name = 'Jesper';
inc.caller_id.email = 'jesper@not-a-real-email.com';
inc.insertWithReferences();

Back to Resources

Want help with this pattern?

Send a short description. I will ask for the minimum needed to be useful.

Contact