function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ClintLeeClintLee 

Authenticated Website License and Vieewing Opportunities

I am having some trouble understanding the ability to Read Opportunities with the Authenticated Website License.

 

Overview:

We track the lifecycle and stages of our consumer customers with the Opportunity object.  I want to create a secure portal where they can simply view the information related to their Opportunities.  In order to do this they need to be authenticated. 

 

What I've Done:

I have a site which requires login and we are using the Authenticated Website license.  This profile does not have the option to grant Read access to Opportunities.  I have created a User with the Authenticated Website license and profile.  When logged in as this User I cannot display the Opportunities on a custom VF page. 

 

However, I wanted to test the ability to create an Opportunity when logged in as this user, so I created a button on the VF page that would create an Opportunity when clicked.  It worked and I was able to create an Opportunity when logged in as this User with the Authenticated Website License.  The Public Access Setting for this Site does grant Read and Create access on Opportunities but I don't know if that has anything to do with it.

 

This leaves me confused and having some questions:

1. I've been told that only the Partner Portal license has access to Opportunities.  If that's the case, why am I able to create Opportunities with the Authenticated Website license?

2. Do the Public Access Settings for the Site have any effect on access even when not using that particular license?

3. If I can create an Opportunity, why can I not view Opportunities when logged in with the Authenticated Website license?

 

Sharing settings for Opportunities are set to Public Read/Write.

 

Thanks in advance for any insight!

 

~ Clint

Best Answer chosen by Admin (Salesforce Developers) 
osamanosaman

The reason you can create the opportunities is because you must be using "without sharing" token in your class. That will execute whatever method is written in your class. But you cant display the data on the visualfroce page with Authenticated Site User profile. There is a work around for that.

 

Authrnticated Site user can view the data on visualforce page using only primitive data type variable. You cant view any information of List<Opportunity> but u can display tha data of a List<String>

 

You need to generate a proxy class and do the required stuff.

All Answers

osamanosaman

The reason you can create the opportunities is because you must be using "without sharing" token in your class. That will execute whatever method is written in your class. But you cant display the data on the visualfroce page with Authenticated Site User profile. There is a work around for that.

 

Authrnticated Site user can view the data on visualforce page using only primitive data type variable. You cant view any information of List<Opportunity> but u can display tha data of a List<String>

 

You need to generate a proxy class and do the required stuff.

This was selected as the best answer
ClintLeeClintLee

Thanks, Osama.  I was able to create a wrapper class for the Opportunity object that outputs the fields as Strings and it displays.

 

However, in the class that creates the opportunity I am using "WITH sharing" so I'm still unclear as to how that's working.

 

~ Clint

osamanosaman

Thats something strange. Do you mind posting your code here?