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
SubhaSubha 

Insufficient privileges

The controller that I have created is :

public class CandidateList {

    Candidate__c candidate ;
    public Candidate__c getCandidate() {
        Id id = ApexPages.currentPage().getParameters().get('id');
       
        candidate = [Select Id, Name from Candidate__c
where id = :ApexPages.currentPage().getParameters().get('id')];
return candidate;
    }

-----------------

and the page that i developed

<apex:page Controller="CandidateList">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are displaying Candidates List.
Mouse over a Candidate's name to view his or her details.
</apex:pageBlock>
<apex:pageBlock title="Candidates">
<apex:form >
<apex:dataTable value="{!candidate}" var="contact" cellPadding="4"
border="1">
<apex:column >
<apex:outputPanel >
<apex:actionSupport event="onmouseover" rerender="detail">
<apex:param name="cid" value="{candidate__c.id}"/>
</apex:actionSupport>
{!contact.Name}
</apex:outputPanel>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="detail">
<apex:actionStatus startText="Requesting...">
<apex:facet name="stop">
<apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="false"
title="false"/>
</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
</apex:page>


Can any one suggest y I am getting Insufficient privileges when I am putting mouse on the value to get the detail

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

Please check sharing rules might be possible you have some sharing rules that do not allow actions on record by any other then record owner.

All Answers

Ankit AroraAnkit Arora

If you are getting the error "Insufficient Privileges" then nothing to do with your code. Problem is in profile permissions. I hope you are not logged in as System Administrator.

 

If you are logged in as Partner Portal or Customer Portal then just go to the profile : Setup > Administration Setup > Manage Users > Profile.

 

Provide all permissions to candidate object.

 

If you are doing this from site then Goto : Setup > App Setup > Develop > Sites > Click on Site Label > Public Access Setting > Provide access to object Candidate.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

SubhaSubha
Thanks for the reply but unfortunately I am logged in as System Administrator... Do I need to be some other user instead of System Administrator??? I am learning.. so please help
Ankit AroraAnkit Arora

You can follow the same path Setup > Administration Setup > Manage User > Profile > System Administration

 

And provide all permissions for object you are using in code. Also verify your visualforce page and apex class is added on that profile.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

SubhaSubha

I have checked and all the permissions are given for standard and custom objects in System Administrator profile

Checked the apex page and class both are having permissions for the System Administrator profile only....

 

But still getting error as:

 

Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

Shashikant SharmaShashikant Sharma

Please check sharing rules might be possible you have some sharing rules that do not allow actions on record by any other then record owner.

This was selected as the best answer
SubhaSubha
Thank u I am able to solve it with ur reply... Thank u vry much
avkavk

Hello Shashi..!   I have the same issue.. I've even tried checking sharing rules too and it didn't worked.. Infact I have no sharing rules defined and im a system admin user. I've given permissions to all the fields for all standard and custom objects.

SubhaSubha

Just check this:

 

Goto Administration setup-->security controls-->Sharing settings

 

In this if ur Object is custom object then its default access is Private so change that to public then it wil work

Anil ValluriAnil Valluri

No its not Private.. Its Public Read Write already and its not working..