We revisited the dot walking concept last week. It is a very handy feature to know be able to use while writing concise scripts. But it has its own "gotchas" as well.
Despite the ease with which it can be used, it is still an additional database query. So, we should actively be looking to minimize the database queries. If we are after some information like the "sys_id" or the display name of a referenced record, we don't really need to dot walk to that table. Both the display name and the sys_id are stored as field values and to effectively use them, use either the "getDisplayValue()" or "getValue()" method. Of course, you can also use other ways to explicitly convert the stored sys_id to a string value like toString().
Consider those values as a business card of the referenced records. You don't want your gr to keep visiting every referenced records, just to know their name or sys_id. :)
Comments
Post a Comment