FOR REFERENCE in SOQL

FOR REFERENCE is used to notify Salesforce when a record is referenced. The LastReferencedDate field is updated for any retrieved records.

Sample Query:
SELECT City__c, State__c, LastReferencedDate FROM Employee__c FOR REFERENCE

If we execute the above query, for the first time, it shows the lastly referenced date of the record in LastReferencedDate. But for the second time, all the records will show the same date and time (date and time when we executed the query for the first time) for LastReferencedDate.

Leave a Reply