logo

NJP

122. addExtraField

Import · Jun 10, 2024 · article

In the Washington DC release, there is a new GlideRecord method called “addExtraField” that can help us write more efficient queries, especially when dot walking. The difference is observed when trying to dotwalk more than 2 layers.

It allows you to query dot-walked fields in a single database request, rather than perform multiple queries per dot-walked element in a form or script (which requires multiple round trips to the database)

Example

var gliderecord = new GlideRecord(“incident”);

gliderecord.addQuery(“number”, “INC0041457”);

gliderecord.addExtraField(“cmdb_ci.location.contact.name”);

gliderecory.query();

gliderecord.next();

gs.info(gliderecord.cmdb_ci.location.contact.name);

View original source

https://medium.com/@LearnITbyPrashant/122-addextrafield-739b81a51379?source=rss-d005fc598f0a------2