Pergunta

From within an Apex class, how can I detect the Edition (ie, Group, Professional, Enterprise, Unlimited). More specifically, is there an API to retrieve the capabilities (or lack thereof) for the user's edition?

The problem I am trying to solve is that from the Group/Professional edition, users cannot access the custom Web Services in my app, receiving the error LOGIN_OAUTH_API_DISABLED. Is there a way to detect whether this is going to work from within Apex?

Foi útil?

Solução

You can use the following SOQL to determine the Organization's license type:

SELECT OrganizationType FROM Organization

For Professional it will return "Professional Edition". This is detailed on the Organization object page.

Outras dicas

Are there any specific capabilities you're looking to discover? There's no way to determine the edition (and this would be mostly a red herring if you could). A lot of differences end up being reflected in the data model, and you can discover that using the describe features.

If you want to check from apex if your web services is enabled/available, then you could use apex callouts to try and make a call to it (and FWIW, the error code is from OAuth, and not from your apex web service)

"Apex is included in Unlimited Edition, Developer Edition, and Enterprise Edition."

Duh. How are you going to run any Apex code in Group/Professional Editions? There's no Apex, Visualforce pages must be very simple (no Apex = no custom controllers), no webservices API (which also means no Data Loader)...

I'd say just keep your existing code and wrap it in try-catch block?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top