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
Mani Cube84Mani Cube84 

How to display the records using <apex:detail> component in visualforce page

We have a client, they uses salesforce recently, Someone makes Personal Account Enabled in their Org, so if we enabled then we have no rite to disable it.And the OWD for contact appears as controlled by parent, we are unable to make and changes for it to make as private, so that if we want to share any records we can go through sharing rules, because of OWD-controlled by parent, sharing for contact is not visible.  We have tried to workout with Triggers as well but no use of it. 

I referred alot to fix this issue, atlast i found one info that we can achieve itby creating the Visualforce Page and also by using extension along with <apex:detail> tag.   can anyone help me out how to use all this and fix the issue.

Thanks in advance for the response.
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Mani,
How does <apex:detail> work?
<apex:page standardController="account" recordSetVar="accounts" sidebar="false" showHeader="false">
    <apex:panelGrid columns="2">
        <apex:form >
            <apex:pageBlock>
                <apex:pageBlockTable value="{!accounts}" var="a">
                    <apex:column headerValue="Name" >
                        <apex:commandLink value="{!a.name}" reRender="out">
                            <apex:param name="id" value="{!a.id}"/>
                        </apex:commandLink>
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:form>
        <apex:outputPanel id="out">
            <apex:detail subject="{!$CurrentPage.parameters.id}" relatedList="false" title="false"/> 
        </apex:outputPanel>
    </apex:panelGrid>
</apex:page>
hope it helps.

Please mark it as best answer if the information is informative.

Thanks
Rahul Kumar