Best practice when using getRefRecord()Description<!-- div.margin { padding: 10px 40px 40px 30px; } table.tocTable { border: 1px solid; border-color: #e0e0e0; background-color: #fff; } .title { color: #d1232b; font-weight: normal; font-size: 28px; } h1 { color: #d1232b; font-weight: normal; font-size: 21px; margin-bottom: 5px; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #cccccc; } h2 { color: #646464; font-weight: bold; font-size: 18px; } h3 { color: #000000; font-weight: bold; font-size: 16px; } h4 { color: #666666; font-weight: bold; font-size: 15px; } h5 { color: #000000; font-weight: bold; font-size: 13px; } h6 { color: #000000; font-weight: bold; font-size:14px; } ul, ol { margin-left: 0; list-style-position: outside; } --> getRefRecord() returns a GlideRecord object for a given reference element. This is used widely in business rule scripts but incorrect usage of this can cause some major issues. This article describes some issues seen and the best practice to follow to avoid these. Issues Printing values from the record obtained using getRefRecord() might not print anything. Orphan records get inserted when updating the record obtained using getRefRecord(). Using values from record obtained using getRefRecord() in other script results in "undefined" errors. ResolutionIf the reference field has an empty value, getRefRecord() doesn't throw any error but it does return a GlideRecord object. That's why it is important to check if the returned object is a valid GlideRecord object or not. 1 2 3 4 5 6 7 var grUser = current.user.getRefRecord(); if(grUser.isValidRecord()) { // << only perform operations on it if it's a valid record if(grUser.email != current.email_address){ grUser.email = current.email_address; grUser.update(); } } getRefRecord() should always be followed by isValidRecord() check. If expected field is on a child table, make sure the reference field points to the child table and not the parent table. Otherwise the getRefRecord() returns the GlideRecord object from the parent table which will not have the field that exists on the child table resulting in "undefined" errors.