I noticed when I load a record for an object that has its View overridden with a Visualforce page, it does not put this record into the "Recently Viewed" list.
Is there any way to put this record into the Recently Viewed list?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityI noticed when I load a record for an object that has its View overridden with a Visualforce page, it does not put this record into the "Recently Viewed" list.
Is there any way to put this record into the Recently Viewed list?
Querying the record "for view" will cause it to appear on the recent items list. You can do this in the constructor for the Visualforce page. Here's an example:
public MyPageController(ApexPages.StandardController controller) {
SObject[] record = [SELECT Id FROM Account WHERE Id = :controller.getId() FOR VIEW];
In addition to the answer from sfdcfox, if you have a tab created for the object, it will show in the recent items list even without requiring FOR VIEW.