1

I'm setting up a Partner Community (with VF pages) in my dev org , and I've run across a problem displaying opportunities on the community page.

Basically, the community is set up so that a "client" (a contact on an account) can log in and see the data for his or her account. I've successfully displayed the data for a custom object, but the fields for the opportunity data is all blank. I can't tell if I'm just doing something stupid or if there's a Salesforce restriction at play.

The service to get the opportunity data looks like this:

public static List<Opportunity> getOpps(Id accountId2) {
    List<Opportunity> oppList = new List<Opportunity>{};

    if  (accountId2 != null) {
        for (Opportunity opp: [SELECT Id, Name, AccountId FROM Opportunity WHERE AccountId = :accountId2]) { 
            oppList.add(opp);
        }
    }   

    return oppList;
}

Then, in the controller for my VF page I have this:

public AccountPageController(){
    oppList = PortalService.getOpps(contact.Account.Id);
}

And the code to display the data on the VF page looks like this:

    <h2>Opportunities</h2>
    <ul>
        <apex:repeat value="{!oppList}" var="opp">
            <li>
                {!opp.Name}, {!opp.Id}, {!opp.AccountId}
            </li>
        </apex:repeat>
    </ul>

I've also shared the opportunity with the "All Customer Portal Users" group, and I ran the query in the dev console to make sure that I was getting back some data. On my VF page, it shows two bullet points (there are two opportunities, so that's good), but the field data is blank.

Any ideas where I might be going wrong? Thanks in advance for your help!

4
  • Did you check the Field Level Security for your profile? Commented Jul 9, 2015 at 20:44
  • Yes (even though I hadn't added any field-level security)...and here's a weird thing: on the opportunity, the profile choices is a rather limited list (and doesn't include the custom profile that I created for the community), but on my custom object the profile list is quite lengthy and does include the custom profile I created.
    – djackiem
    Commented Jul 9, 2015 at 20:50
  • I haven't completely wrapped my head around it but it's my understanding that Portal User licenses don't have access to all Standard objects (not sure if opportunities falls into this category), but it might explain why Opportunity doesn't appear under 'Standard Field-Level Security' options when viewing that profile? Commented Jul 9, 2015 at 20:58
  • That's what I was worried about, but according to this (Who Can See What in Communities): help.salesforce.com/… , opportunities should be visible to external community users (if I understand it correctly).
    – djackiem
    Commented Jul 9, 2015 at 21:04

1 Answer 1

0

I finally figured this out. The problem was that I had set up my community users with the Customer Community Plus User profile (actually, a clone thereof). This profile did not have opportunities listed on it. When I changed the profile to the Partner Community User (a clone thereof), the read/write settings for opportunities was available, and I was able to see opportunities. I guess it's ultimately a Salesforce licensing issue -- if you want to allow the community users see opportunities, I'm guessing you need to get a partner community license.

You must log in to answer this question.

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