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
SFDCDevQASFDCDevQA 

VF Records not showing up in Recent Items on left

I have some VF Pages being run by somewhat complicated controllers and am running into the issue of the records not showing up in the Recent items side bar.  Has anyone else encountered this issue?  Am I missing something simple?

Here's one of my VF Pages:

<!--
This page allows user to view adversary account, create new adversary contacts.
It also allows editing and deactivating of contacts.
-->

<apex:page standardController="Adversary_Account__c"  extensions="NewAccountController">
    <apex:sectionHeader title="Adversary Account Details" subtitle="{!Account.Name__c}" />
    <apex:form >
      <apex:pageMessages id="pageMessage"/>
        <apex:pageBlock title="Account Details">
            <apex:pageBlockButtons >
                <apex:commandButton value="Edit" action="{!editAccount}" rendered="{!hasEditAccess}"/>
                <apex:commandButton value="Back" action="{!back}" immediate="true" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Account Information" columns="2">
                <apex:outputField value="{!Account.Name__c}" />
                <apex:outputField value="{!Account.Phone__c}" />
                <apex:outputField value="{!Account.Fax__c}" />
                <apex:outputField value="{!Account.Website__c}" />
                <apex:outputField value="{!Account.isActive__c}" />
            </apex:pageBlockSection>
        </apex:pageBlock>
        
        <apex:outputPanel id="contacts">
        <apex:pageBlock title="Active Adversary Contacts" id="ActiveContacts">
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Add New Adversary Contact" action="{!addContact}" rendered="{!hasEditAccess}"/>
            </apex:pageBlockButtons>
            
            <apex:outputText value="{!$Label.No_Contacts}" rendered="{!!showContacts}" />
            <apex:pageBlockTable value="{!contactsToDisplay}" var="con" rendered="{!showContacts}">
                <apex:column >
                    <a href="/apex/ViewContact?contId={!con.id}&accId={!accId}">{!con.Name__c}</a>
                    <apex:facet name="header">Name</apex:facet>
                </apex:column>
                <apex:column value="{!con.Phone__c}">
                    <apex:facet name="header">Phone</apex:facet>
                </apex:column>
                <apex:column value="{!con.Email__c}">
                    <apex:facet name="header">Email</apex:facet>
                </apex:column>
                <apex:column width="10%" rendered="{!hasEditAccess}">
                    <a href="/apex/EditContact?contId={!con.id}&accId={!accId}">Edit</a>
                &nbsp;&nbsp;
                <!--<apex:outputPanel onclick="if(!confirm('{!$Label.Deactivate_Confirmation} contact?')) return false;">
                        <a href="/apex/confirmContactDelete?contId={!con.id}&accId={!accId}">Deactivate</a>
                </apex:outputPanel> -->
                <apex:commandLink onclick="if(!confirm('{!$Label.Deactivate_Confirmation} contact?')) return false;" value="Deactivate" action="{!deactivateContact}" reRender="contacts, pageMessage" >
                    <apex:param name="contId" value="{!con.id}" assignTo="{!contIdToDeActivate}"/> 
                </apex:commandLink>
                    <apex:facet name="header">Actions</apex:facet>
                </apex:column>
            </apex:pageBlockTable>
            <apex:outputPanel rendered="{!showAllContacts}">
                <a href="/apex/AllContacts?accId={!accId}">Show All({!contactsCount})</a>
            </apex:outputPanel> 
        </apex:pageBlock>
        
        <apex:pageBlock title="Inactive Adversary Contacts" rendered="{!showInactiveContacts}" id="inActiveContacts">
            <!--<apex:pageBlockButtons location="top">
                <apex:commandButton value="Add New Adversary Contact" action="{!addContact}" />
            </apex:pageBlockButtons>-->
            <apex:outputText value="{!$Label.No_Contacts}" rendered="{!!showInactiveContacts}" />
            <apex:pageBlockTable value="{!InactiveContactsToDisplay}" var="con" rendered="{!showInactiveContacts}">
                <apex:column >
                    <a href="/apex/ViewContact?contId={!con.id}&accId={!accId}">{!con.Name__c}</a>
                    <apex:facet name="header">Name</apex:facet>
                </apex:column>
                <apex:column value="{!con.Phone__c}">
                    <apex:facet name="header">Phone</apex:facet>
                </apex:column>
                <apex:column value="{!con.Email__c}">
                    <apex:facet name="header">Email</apex:facet>
                </apex:column>
                <apex:column width="10%" rendered="{!hasEditAccess}">
                    <a href="/apex/EditContact?contId={!con.id}&accId={!accId}">Edit</a>
                    &nbsp;&nbsp;
                    <!-- <a href="/apex/ActivateContact?contId={!con.id}&accId={!accId}">Activate</a> -->
                    <apex:commandLink onclick="if(!confirm('{!$Label.ReActivateConfirmation} contact?')) return false;" value="Reactivate" action="{!activateContact}" reRender="contacts, pageMessage" >
                    <apex:param name="contId" value="{!con.id}" assignTo="{!contIdToActivate}"/> 
                </apex:commandLink>
                    <apex:facet name="header">Actions</apex:facet>
                </apex:column>
            </apex:pageBlockTable>
            <apex:outputPanel rendered="{!showAllInactiveContacts}">
                <a href="/apex/AllInactiveContacts?accId={!accId}">Show All({!inactiveContactsCount})</a>
            </apex:outputPanel>
        </apex:pageBlock>
       </apex:outputPanel> 
        <apex:pageBlock title="Related Projects List" rendered="{!showProjects}">
        <apex:outputPanel id="projectList">
        <apex:outputText value="{!$Label.No_Projects}" rendered="{!!showProjects }"/>
        <apex:pageBlockTable value="{!projectList}" var="project" rendered="{!showProjects }">
            <apex:column width="30%">
                <a href="/apex/ViewProject?projId={!project.id}&accId={!accId}">{!project.name}</a>           
                <apex:facet name="header">Name</apex:facet>
            </apex:column>
           <!-- <apex:column value="{!project.Client_Account__r.Name__c}" width="15%">            
                <apex:facet name="header">Client Account</apex:facet>
            </apex:column> -->
            <apex:column value="{!project.Project_Lead__r.Member_Name__c}" width="15%">            
                <apex:facet name="header">Project Leader</apex:facet>
            </apex:column>
            <apex:column value="{!project.Adversary_Account__r.Name__c}" width="15%">            
                <apex:facet name="header">Adversary Account</apex:facet>
            </apex:column>
            <apex:column value="{!project.Adversary_Lead__r.Member_Name__c}" width="15%">            
                <apex:facet name="header">Adversary Leader</apex:facet>
            </apex:column>
           <!-- <apex:column width="10%">
                <a href="/apex/EditProject?projId={!project.id}&accId={!accId}">Edit</a>
                &nbsp;&nbsp;               
                <apex:commandLink onclick="if(!confirm('{!$Label.Close_Confirmation} project?')) return false;" value="Close Project" action="{!deactivateProject}" reRender="projectList, pageMessage" rendered="{!hasEditAccess}">
                    <apex:param name="projId" value="{!project.id}" assignTo="{!projIdToDeActivate}"/> 
                </apex:commandLink>
                <apex:facet name="header">Actions</apex:facet>
            </apex:column> -->
        </apex:pageBlockTable>
        </apex:outputPanel>
        <!--<apex:pageBlockButtons location="top"> 
                <apex:commandButton value="Create New Project" action="{!createNewProject}"/>
        </apex:pageBlockButtons>-->
        </apex:pageBlock>
    
    </apex:form>
    <c:Copyright /> 
</apex:page>
SFDCDevQASFDCDevQA

I got it to work finally by adding in the detail section and hiding it and including the title.  Had to change some of my controller to do so...not sure how much coding I'm going to have to change to fix that. Any other solutions?

 

Thanks,

Amanda

Alderete_SFDCAlderete_SFDC

Adding records to the Recent Items sidebar widget is not something that Visualforce pages do by default. I'm not even sure if you can do it on purpose.

 

The only doc I could find is in the API docs, for setting the MruHeader, but that's for making API calls, not in Apex.

 

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_header_mruheader.htm|StartTopic=Content%2Fsforce_api_header_mruheader.htm|SkinName=webhelp

 

I'm told that there's more developer doc for this feature, but it may be in pilot only at this point.

 

I'll research this more tomorrow when the relevant writer is back in the office, and post again.

Alderete_SFDCAlderete_SFDC

OK, my colleagues pointed me to the right documentation. This is a feature that is new in Summer '13, so the details are (today) only available in our pre-release docs. It's possible we tell Google not to index them (but I also notice that the term "most recently used" isn't in these docs, so that could have done it, too).

 

What you want is a new feature in SOQL that updates the RecentlyViewed object for the user. You can find the release notes in: Force.com > API > SOQL > FOR VIEW and FOR REFERENCE SOQL Clauses. That will give you a brief introduction.

 

For more complete details, check out the following docs:

 

I hope this gives you what you need, and please report back if it doesn't!