2

When I use Schema.describeSObjects() the result always returns isDeletable=TRUE, even though the current user doesn't have DELETE permission on an sObject; however if Schema.sObjectType.<<sObject>> is used, then it returns expected result i.e. isDeletable=FALSE.

Above observation was found for isCreateable flag as well!

3
  • I would recommend simply not using it because it's far slower than single describe calls for now.
    – sfdcfox
    Jun 27, 2018 at 14:58
  • I've a requirement where I need to pass the sObject name dynamically to retrieve Access permissions for any sObject(a generic method), cannot harcode like Schema.sObjectType.Account etc.
    – Tanmay K
    Jun 27, 2018 at 15:17
  • See this answer for a dynamic alternative.
    – sfdcfox
    Jun 27, 2018 at 15:21

2 Answers 2

1

If the describe call is returning incorrect values, that's a bug that definitely needs to be fixed. I will send a short message to some people I know on the Salesforce side, but you should definitely log a case so they can file a bug for this.

1

In case any one else ends up here - this was a bug, and was fixed in Winter 19 - but it was also a versioned change, so unless you update your API version in the class, it is still not going to work!

Note that while this issue is fixed in WInter '19, the change has been versioned to avoid breaking previously functional code. It is strongly advised that you upgrade your Apex class API version to opt-in to the corrected behavior.

Link to KI:

You must log in to answer this question.

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