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
3 Creeks3 Creeks 

System Admin Profile getting Insufficient Privileges error

I have a managed packaged that is installed in an unlimited edition sandbox.  When a user with a system admin profile accesses the application, they receive a Insufficient Privileges error when the code makes a call to Schema.describeSObjects(). 

The user is using the standard System Admin profile, not one cloned from the standard System Admin profile.

I have not been able to replicate the issue in my own environments.

Does anyone have any idea of what might be going on?

Thanks
Best Answer chosen by 3 Creeks
3 Creeks3 Creeks
I found the issue.  

The code was trying to construct the name of the objects it was interested in describing and sometimes the name of the object was constructed wrong.   What threw me was that the message the customer got was "Insufficient Privileges" on the screen and Schema.describeSObjects() was throwing an "API not accessible" exception in the logs. 

When I finally was able to replicate the issue, the message I got was completely different both on screen and in the logs.  I got a message that basically said the object does not exist, so it was obvious then.  

I was never able to get the same message the user got...strange.

Thanks for your response.

All Answers

Andy BoettcherAndy Boettcher
Does your Managed Package require a license to be allocated to that user to access those objects?  The SysAdm standard profile indeed has automatic access to all objects, but a MP license can break that.
3 Creeks3 Creeks
I found the issue.  

The code was trying to construct the name of the objects it was interested in describing and sometimes the name of the object was constructed wrong.   What threw me was that the message the customer got was "Insufficient Privileges" on the screen and Schema.describeSObjects() was throwing an "API not accessible" exception in the logs. 

When I finally was able to replicate the issue, the message I got was completely different both on screen and in the logs.  I got a message that basically said the object does not exist, so it was obvious then.  

I was never able to get the same message the user got...strange.

Thanks for your response.
This was selected as the best answer