I have an object which is private at OWD. I am trying to display all the user's records of that object in the Visualforce page. Is it possible? How to display?

  • Please share what you've tried so far. – Basti Oct 24 '17 at 14:17

As long as the user's profile contains the Read <Object> permission (where Object is the object you'd like to display), you can display those records in a Visualforce page. By default, with Private sharing, users can only see their own records, records of users below them, and any records shared with them. As a generic example, the following code shows the user every account they can view:

<apex:page standardController="Account" readOnly="true" recordSetVar="records">
    <apex:sectionHeader title="Account List" />
        <apex:pageBlockTable value="{!records}" var="record">
            <apex:column value="{!record.Name}" />
            <apex:column value="{!record.Industry}" />
            <apex:column value="{!record.BillingState}" />

If you need more complicated logic, you might need to also write a controller or extension, but the principle remains the same.

| improve this answer | |

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.