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
JWikkJWikk 

describeSObjects error due to profile permission setting...how to check permission first?

Hi there, our code is describing a list of sobjects. The describe call is returning with the error: "INVALID_TYPE: sObject type 'MUSW__Permit__c' is not supported."

 

We know this is due to the profile not given any permissions on a particular object in the list. How do we check in the code to see if the user's profile has access to the objects first and then call describe on the list?

 

The situation is in an scontrol, but we need to learn how to do this in apex also. Our main concern is that describe calls are expensive in time, so we want to minimize the amount of describe calls to make.

 

Ideas?

 

Prajapati.LakhanPrajapati.Lakhan

Hi,

 

If global describe does not cost too much for your application, then you can use it to get the map of only those objects which you have access to then can iterate through the map to limit the describe call for the objects you want.

 

 

Thanks,

Lakhan