+ Start a Discussion
AshlekhAshlekh 

Opportunity Access for customer community and customer community licenses

I can't show opportunity tab to customer community and customer community licenses users. And on the profile level there is no any option for this.

I read the documents and type of licenses and according to them opportunity is not available for user which these type of licenses.

But here I've two doubts

1) Here I have a controller and apex page. In controller I can get all the opportunities and all fetched opportunities are saved in wrapper class and then using a this wrapper class I can show opportunity and it is running successfully.

2) Here I have a controller and apex page. In controller I can get all the opportunities and saved in list and this list is a type of opportunity eg List<Opportunity> x. When I try to display oppty (using X) I got exception.

I am access my apex page from community portal.

My question if opportunity is not accessible to Customer portal and C Portal Licenses user the how can controller fetch the opportunities data ans show through the wrapper class and not opportunity type list
Nilesh Jagtap (NJ)Nilesh Jagtap (NJ)
Hi,

When we execute any class with "without sharing" keyword the class gets executed in system context that means you can access all objects data. But when you add "with sahring " keyword to you class declaration, salesforce will enforce all security and sharing settings applicable for logged in user restricting access to objects. For more info on with sharing/without sharing keywords you can go through https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_keywords_sharing.htm

e.g.
//Use the with sharing keywords when declaring a class to enforce the sharing rules that apply to the current user. For example:

public with sharing class sharingClass {

     // restricted access

}

//Use the without sharing keywords when declaring a class to ensure that the sharing rules for the current user are not enforced. For example:

public without sharing class noSharing {

     // this will run in system context providing access to all objects

}


If this helps, mark this as best answer.

Thanks,
N.J
AshlekhAshlekh
Hi N.J ,

I can get the records in both cases.
Sarah DickinsonSarah Dickinson
Hi,

Were you able to find a woraround for that?

Thanks!