5

I have created a package and in it I have two custom objects foo__c and bar__c. My question is can I assume that their entity id (the first 3 digits of their id) is the same across all of the Orgs that use my package?

6

Behavior of custom object prefix ID when using Change Sets

Knowledge Article Number: 000176809

Depending on the type of Sandbox you are using, a custom object prefix ID might change upon deploying it on a target organization. This article gives all the possible scenarios and their outcome.

Resolution

The list below assumes you are transferring a Change Set from a Sandbox to another Sandbox or a Production instance.

If you transfer a Change Set from

  • Developer Sandbox to Full Sandbox
  • Developer to Production.
  • Configuration to Full Sandbox
  • Configuration to Configuration Sandbox.
  • Configuration To Production.
  • Full Sandbox to Developer Sandbox
  • Full Sandbox to Configuration Sandbox.

The custom object ID Prefix will be different. Salesforce will generate a new custom object ID.

If you transfer a Change Set from

  • Full Sandbox to Production
  • Configuration to Developer sandbox.
  • Developer to Configuration Sandbox.
  • Developer to Developer Sandbox

The custom object ID Prefix will remain the same.

| improve this answer | |
  • That is what I figured since a Production org can have multiple packages. – Louis Pujol Jun 17 '15 at 20:55
3

When a managed package is installed, the 3 digit prefix of a custom object will vary: the values are allocated perhaps on a "first custom object created" basis and so will vary from org to org.

So in your code you should not assume a fixed value but instead use e.g. DescribeSObjectResult.getKeyPrefix() or grab the first 3 characters of an ID that you know is of the correct type.

| improve this answer | |
0

Yes! The package runs in your context.

The first 3 digit will be same across all the organisation where your package is installed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.