0

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?

1
  • Please share what you've tried so far.
    – itsmebasti
    Commented Oct 24, 2017 at 14:17

1 Answer 1

4

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:pageBlock>
        <apex:pageBlockTable value="{!records}" var="record">
            <apex:column value="{!record.Name}" />
            <apex:column value="{!record.Industry}" />
            <apex:column value="{!record.BillingState}" />
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .