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
adi salesforceadi salesforce 

how to create recently created,recently modified,recently viewed drop down using standard controller of account.

sowmya Inturi 9sowmya Inturi 9
Hi Adi,
Please try the below code. You can get all the list view options by using the standard controller.

<apex:page standardController="Account" recordSetvar="accounts">
  <apex:pageBlock title="Viewing Accounts">
  <apex:form id="theForm">
    <apex:panelGrid columns="2">
      <apex:outputLabel value="View:"/>
      <apex:selectList value="{!filterId}" size="1">
        <apex:actionSupport event="onchange" rerender="list"/>
        <apex:selectOptions value="{!listviewoptions}"/>
      </apex:selectList>
    </apex:panelGrid>
    <apex:pageBlockSection >
      <apex:dataList var="a" value="{!accounts}" id="list">
        {!a.name}
      </apex:dataList>
    </apex:pageBlockSection>
  </apex:form> 
  </apex:pageBlock>
</apex:page>


Thanks,
Sowmya.
Ajay K DubediAjay K Dubedi
Hi Adi,

You can try the following code :

VF page :
<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
    <apex:pageBlock >
        <apex:form >
            <apex:panelGrid columns="2">
                <apex:outputLabel value="View:"/>
                <apex:selectList value="{!filterId}" size="1">
                    <apex:actionSupport event="onchange" rerender="list"/>
                    <apex:selectOptions value="{!listviewoptions}"/>
                </apex:selectList>
            </apex:panelGrid>
            <apex:pageBlockTable value="{!accounts}" var="a" id="list">
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Site}"/>
                <apex:column value="{!a.Phone}"/>
                <apex:column value="{!a.Type}"/>
            </apex:pageBlockTable>
        </apex:form>
    </apex:pageBlock>
</apex:page>

    
Please mark as best answer if it helps you.

Thank You 
Ajay Dubedi