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!
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?