No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
FOR VIEW
Salesforce stores information about record views in the interface and uses it to generate a list of recently viewed and referenced records, such as in the sidebar and for the auto-complete options in search. You can use the FOR VIEW clause to notify Salesforce when a record is viewed from a custom interface, such as in a mobile application or from a custom page, so that the recently viewed data is always current. Consider using the FOR VIEW clause in conjunction with the FOR REFERENCE clause to update recent usage data for retrieved objects.
- 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.
This is an example of a SOQL query that retrieves one contact to show to the current user and uses FOR VIEW to update the last viewed date of the retrieved contact. The same statement both retrieves the record and updates its last viewed date.
1SELECT Name, ID FROM Contact LIMIT 1 FOR VIEW