In this blog we are going to learn about how to show sObject home page in visualforce page. Let’s take the sObject Account to show the home page. For this example we only use standard controller Account in our visualforce page.
Example
Create a visualforce page.
1). Goto>>Setup>>Develop>>Visualforce Page.
2). Create New.
3). Write following code.
<apex:page standardController="Account" recordSetvar="Accounts" sidebar="false"> <!-- /** * Webkul Software. * * @category Webkul * @author Webkul * @copyright Copyright (c) 2010-2017 Webkul Software Private Limited (https://webkul.com) * @license https://store.webkul.com/license.html */ --> <head> <style> .head{ font-size:1.3em; } </style> </head> <apex:form > <apex:sectionHeader title="Accounts" subtitle="Home" help="https://help.salesforce.com/articleView?err=1&id=accounts.htm&siteLang=en_US&type=0" /> <apex:panelGrid columns="6"> <apex:outputLabel value="View:"/> <apex:selectList value="{!filterId}" size="1" id="sel" > <apex:actionSupport event="onchange" action="{!list}"/> <apex:selectOptions value="{!listviewoptions}" /> </apex:selectList> <apex:commandButton value="GO!" action="{!list}" /> <apex:outputLink value="/ui/list/FilterEditPage?id=00B6F00000Al7Nt&retURL=%2F001&cancelURL=%2F001%2Fo%3Fhotlist_mode%3D2"> <apex:outputtext value="Edit"/></apex:outputLink>| <apex:outputLink value="/ui/list/FilterEditPage?ftype=a&retURL=%2F001&cancelURL=%2F001%2Fo%3Fhotlist_mode%3D2"> <apex:outputtext value=" Create New View"/></apex:outputLink> </apex:panelGrid> <apex:pageBlock > <apex:panelGrid columns="2" width="50%"> <h1 class="head">Recent Accounts</h1> <apex:commandButton value="New" action="/001/e"/> </apex:panelGrid> <apex:pageBlockTable value="{!accounts}" var="item" id="list"> <apex:column headerValue="Account Name"> <apex:outputLink value="/{!item.id}"> <apex:outputText >{!item.name}</apex:outputText> </apex:outputLink> </apex:column> <apex:column headerValue="Billing City"> <apex:outputtext value="{!item.billingcity}"/> </apex:column> <apex:column headerValue="Phone"> <apex:outputtext value="{!item.phone}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <apex:panelGrid columns="2" width="100%" > <apex:pageBlock mode="edit" > <h3 class="head">Reports</h3> <apex:pageblocksection columns="1"> <apex:outputLink value="/00O/e?colDt_c=DUE_DATE&colDt_s=3%2F3%2F2017&rt=1&retURL=%2F001%2Fo&c=AO&c=AN&c=A1SA&c=TY&c=RT&c=IN&c=CD&t=title1&edit=yes&scope=user&details=yes&sort=ACCOUNT.NAME&eirb=1"> <apex:outputText >Active Accounts</apex:outputText> </apex:outputLink> <apex:outputLink value="/00O/e?colDt_c=DUE_DATE&rt=1&retURL=%2F001%2Fo&colDt_e=2%2F10%2F2017&c=DD&c=AO&c=AN&c=A1SA&c=TY&c=RT&c=UD&t=title2&edit=yes&scope=user&details=yes&sort=DUE_DATE&eirb=1"> <apex:outputText >Account With Last Active>30 days</apex:outputText> </apex:outputLink> <apex:outputLink value="/00O?rt=47&retURL=%2F001%2Fo¶mform=yes&sort=ACCOUNT_NAME&name_op=sw&t=title1&details=yes"> <apex:outputText >Account Owners</apex:outputText> </apex:outputLink> <apex:outputLink value="/00O/e?rt=69&retURL=%2F001%2Fo&c=MA&c=PR&c=RN&c=FN&c=LN&c=DD&c=AO&c=AN&c=A1SA&c=TY&c=RT&c=UD&t=titleContactRole&edit=yes&scope=user&details=yes&sort=ACCOUNT.NAME&eirb=1"> <apex:outputText >Contact Role Report</apex:outputText> </apex:outputLink> <apex:outputLink value="/00O?rt=111&retURL=%2F001%2Fo&sortdir=down&sort=CD&sdate=3%2F10%2F2017&edate=3%2F10%2F2017&break0=AN&c=AN&c=OW&c=CR&c=FD&c=OV&c=NV&c=CD&details=yes&format=t"> <apex:outputText >Account History Report </apex:outputText> </apex:outputLink> <apex:outputLink value="/00O/e?rt=45&retURL=%2F001%2Fo&c=AO&c=AN&c=TY&c=P_AN&c=P_RO&edit=yes&scope=user&details=yes&sort=ACCOUNT.NAME&eirb=1"> <apex:outputText >Partner Accounts</apex:outputText> </apex:outputLink> </apex:pageblocksection> </apex:pageBlock> <apex:pageBlock mode="edit" > <h1 class="head">Tools</h1> <apex:pageblocksection columns="1"> <apex:outputLink value="/00O/e?colDt_c=DUE_DATE&colDt_s=3%2F3%2F2017&rt=1&retURL=%2F001%2Fo&c=AO&c=AN&c=A1SA&c=TY&c=RT&c=IN&c=CD&t=title1&edit=yes&scope=user&details=yes&sort=ACCOUNT.NAME&eirb=1"> <apex:outputText >Active Accounts</apex:outputText> </apex:outputLink> <apex:outputLink value="/00O/e?colDt_c=DUE_DATE&rt=1&retURL=%2F001%2Fo&colDt_e=2%2F10%2F2017&c=DD&c=AO&c=AN&c=A1SA&c=TY&c=RT&c=UD&t=title2&edit=yes&scope=user&details=yes&sort=DUE_DATE&eirb=1"> <apex:outputText >Account With Last Active>30 days</apex:outputText> </apex:outputLink> <apex:outputLink value="/00O?rt=47&retURL=%2F001%2Fo¶mform=yes&sort=ACCOUNT_NAME&name_op=sw&t=title1&details=yes"> <apex:outputText >Account Owners</apex:outputText> </apex:outputLink> <apex:outputLink value="/00O/e?rt=69&retURL=%2F001%2Fo&c=MA&c=PR&c=RN&c=FN&c=LN&c=DD&c=AO&c=AN&c=A1SA&c=TY&c=RT&c=UD&t=titleContactRole&edit=yes&scope=user&details=yes&sort=ACCOUNT.NAME&eirb=1"> <apex:outputText >Contact Role Report</apex:outputText> </apex:outputLink> <apex:outputLink value="/00O?rt=111&retURL=%2F001%2Fo&sortdir=down&sort=CD&sdate=3%2F10%2F2017&edate=3%2F10%2F2017&break0=AN&c=AN&c=OW&c=CR&c=FD&c=OV&c=NV&c=CD&details=yes&format=t"> <apex:outputText >Account History Report </apex:outputText> </apex:outputLink> <apex:outputLink value="/00O/e?rt=45&retURL=%2F001%2Fo&c=AO&c=AN&c=TY&c=P_AN&c=P_RO&edit=yes&scope=user&details=yes&sort=ACCOUNT.NAME&eirb=1"> <apex:outputText >Partner Accounts</apex:outputText> </apex:outputLink> </apex:pageblocksection> </apex:pageBlock> </apex:panelGrid> </apex:form> </apex:page>
Support
That’s all about how to show sObject home page in visualforce page, still if you have any further query, feel free to contact us, we will be happy to help you
https://wedgecommerce.com/contact-us/