Dot-walking and GlideElement

As we learned in a previous chapter, dot-walking allows you to access fields on related records via a reference field, by chaining field names separated by dots. For example, to get the email address of the person to whom an incident is assigned from a business rule on the Incident table, you might use the following code:

var assignedEmail = current.assigned_to.email.toString(); 

You might notice that I also used the toString() method above. This is because, as we saw in the server-side Glide API documentation, fields accessed from server-side GlideRecords return GlideElement objects; not just values. JavaScript will generally coerce (cast) values to whatever datatype you're trying to use it as, but it is always ...

Get Learning ServiceNow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.