3

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?

  • 1
    Have you tried querying it in the constructor "for view"? I guess that might be impractical to have to do on every page, but a workaround nevertheless. – sfdcfox Oct 28 '15 at 1:54
  • That was what I was looking for! Please make it an answer and I'll accept it, thanks! – Ray Dehler Oct 28 '15 at 19:13
3

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];
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.