This document describes the best practices for using the getRecord() method.
The signature of getRecord() method is to populate out values from the cache based on session. This method should be used where you are not using the session data but the actual data from the database and which should not be changing based frequently. The method call is used for performance reasons so that the client doesn't have to make frequent calls to server based on the transaction to fetch the data.
It is used when things that need performance/access the user record frequently and ok with not seeing updated info/changes for the duration of a transaction. If the script is fetching the data which is not present in the database using this method, it will return the data stored in the cache. This can result in inconsistency with the data.
When not to use getRecord():
- In business rules which check for session level data, like gs.getSession() etc.
- As a default value in variables, because it might yield inconsistent results, it may return data for another logged in user which is a risk.