Skip to main content
3 of 4
added 109 characters in body
Raul
  • 18.9k
  • 5
  • 42
  • 70

Describe call with Schema.getGlobalDescribe() is trying to look for an object; its API name is hardcoded without namespace, hence might not exists in org where package is installed.

To solve the issue, you would need to get the add a namespace prefix to the object name.

Refer this question to Dynamically get a namespace prefix.

Note: Never hardcode the object name in package and be careful with places where a namespace is required.


Relevant information from documentation-

Starting with Apex saved using Salesforce API version 28.0, the keys in the map that getGlobalDescribe returns are always prefixed with the namespace, if any, of the code in which it is running.

For example, if the code block that makes the getGlobalDescribe call is in namespace NS1, and a custom object named MyObject__c is in the same namespace, the key returned is NS1__MyObject__c.

Raul
  • 18.9k
  • 5
  • 42
  • 70