function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sakthidasan salesfrocesakthidasan salesfroce 

soql for view and for reference

I'm new to salesforce I'm learning soql.Please explain, FOR REFERENCE and FOR VIEW difference
Best Answer chosen by sakthidasan salesfroce
Nagendra ChinchinadaNagendra Chinchinada
As per the documentation both do the similar work.

FOR REFERENCE :
The LastReferencedDate field is updated for any retrieved records.
A record is added to the RecentlyViewed object to reflect the recently referenced data for each retrieved record.


FOR VIEW :
The LastViewedDate field for the retrieved record is updated.
A record is added to the RecentlyViewed object to reflect the recently viewed data for the retrieved record.

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_for_reference.htm

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_for_view.htm