Development questions

How does the FOR VIEW and FOR REFERENCE clause work in SOQL?

DevelopmentMediumInfosysPersistentEY

FOR VIEW updates the LastViewedDate of the returned records so they show up in the user's Recently Viewed list. FOR REFERENCE updates LastReferencedDate (the record was referenced, e.g. in a lookup, without being viewed).

They are used to track usage so records appear in recent items and lookups.

soql
SELECT Id, Name FROM Account WHERE Id = :accId FOR VIEW

The data lives on the RecentlyViewed object (LastViewedDate, LastReferencedDate).

soqlkeywords