You need to sign in to do that
Don't have an account?
raSFUser
Unfortunatly this is resulting in an "Entity is not org-accessible" error when i disable Quotes and the Apex falls over (does not continue to the catch) can somone help identify what my issue is / how i can do this check.
conditional apex
I have some apex i want to run but only if Quotes are an enabled feature, i have tried to check this by doing the following.
public static Boolean sfQuotesEnabled () { boolean enabled; // sObject types to describe String[] types = new String[]{'Quote'}; Schema.DescribeSobjectResult[] results; try{ // Make the describe call results = Schema.describeSObjects(types); }catch(DmlException e){ System.debug('sfQuotesEnabled: failed to get object type'); enabled = false; } System.debug('Got describe information for ' + results.size() + ' sObjects.'); if(results.size() > 0){ enabled = true; } return enabled; }
Unfortunatly this is resulting in an "Entity is not org-accessible" error when i disable Quotes and the Apex falls over (does not continue to the catch) can somone help identify what my issue is / how i can do this check.
"Entity is not org-accessible" error will be there whenever you have object disabled (In your case, Quote). reason being Apex runtime will not be able to understand 'Quote' passed to Schema.describeSObjects as it is currently disabled.
Better to keep it enabled and then you can check for positive result onyl.
If you need further reading about this issue, refer - https://www.srinivas4sfdc.com/2016/01/error-entity-is-not-org-accessible.html
Let me know if this helps!