Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

PrashantLearnIT
Giga Sage

Hello Everyone,

 

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);

 

If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL

 

Best Regards,

Prashant Kumar (LearnIT)

 

YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant

Blog LearnIT: https://medium.com/@LearnITbyPrashant

Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/

ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635

10 Comments