Weekly dose of ServiceNow features in Washington DC release - Week 2 - addExtraField()
Import
·
Jun 06, 2024
·
article
Below is an example of a script to fetch the email of the person whom the problem is assigned, and the problem record is referenced in an incident.
var gliderecord = new GlideRecord("incident");
gliderecord.addQuery("number", "INC0000002");
gliderecord.addExtraField("problem_id.assigned_to.email");
gliderecord.query();
gliderecord.next();
gs.print(gliderecord.problem_id.assigned_to.email);
//Output
//problem.coordinator_b@example.com
In the above script we will get the same result without using addExtraField() method, but by using it we are optimizing the efficiency of code by reducing the database calls.
You can find the official documentation here.
Regards,
Mohit Kaushik
2XServiceNow MVP (2023-2024)
Labels:
View original source
https://www.servicenow.com/community/developer-blog/weekly-dose-of-servicenow-features-in-washington-dc-release-week/ba-p/2954401