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 best to explicitly convert values derived from GlideElement objects. Otherwise, you risk getting the wrong data type. When not dot-walking, you can explicitly get a string...