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.

This problem I am facing every time after deployed the class.

public Class classA {

I checked security to class, which is enabled to all profiles

  • Can you give us more information? What kind of class is it? when you get this error? Apr 14, 2014 at 14:24
  • If you introduce your own class called Test this will hide any unqualified references to salesforce.com/us/developer/docs/apexcode/Content/…. I can't see how that would cause your problem; just best to avoid (or always use System.Test to access the platform's class).
    – Keith C
    Apr 14, 2014 at 14:35
  • Ah..the same issue what i got on the other day..you only helped me. Thanks, @KeithC Thanks for pointing out this issue here.
    – Bforce
    Apr 14, 2014 at 14:38
  • Are you having issues if you deploy ANY class, or is it just this one?
    – dphil
    Apr 14, 2014 at 14:49
  • help.salesforce.com/apex/… this is the similar scenario, but I am not getting
    – Bharat
    Apr 14, 2014 at 15:29

3 Answers 3


It may be the issue with version number!! for us it worked fine after having same version number :)

  • I don't see how this answers the question... can you clarify how @Bharat?
    – Matt Lacey
    Apr 27, 2014 at 1:33
  • 1
    @LaceySnr , It was happened like the after the class is implemented/modified/deployed then the field in Opportunity is created so the version of Opportunity created is high(Ex 30) and the class version is 27 or low ..then it thrown error for insufficient privileges...
    – user7601
    Apr 28, 2014 at 14:02
  • Thanks for the info Uday... much more useful for those who find this answer in the future :)
    – Matt Lacey
    Apr 29, 2014 at 0:17

As a rule of thumb, don't name your classes the same as System classes. Salesforce already has a Test class so you should probably name it something different.

public Class test {

Change it to something like:

public Class TestCode {

The class name here is still pretty generic but at least you aren't naming it the same as a System class. This might not be the reason you are having issues, but it will definitely help you moving forward.

EDIT: Seems like you updated your code to not use the name Test anymore so I guess this response isn't very valid. I'll leave it though since it could potentially still be useful for someone else.

  • hey i just updated the question to avoid the confusion.. please have a look
    – Bharat
    Apr 14, 2014 at 14:48
  1. try public without sharing or
  2. while deploying your class, do not forget to include the profiles for which you want to give access or

3. create a sharing rule (for example on the Account records) which will give the users or profiles with lesser privilege access to the records which has been created by the users with higher privilege. This will solve this issue.

  • I tried with this, but it can't help
    – Bharat
    Apr 14, 2014 at 14:46

You must log in to answer this question.

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