3

We have included [AddCustomRelationships:10] to the scratch org definition file, however, the package versioning still fails with the following error:

"reached maximum number of custom fields: Either you or your organization has exceeded the maximum number of custom fields allowed in the system. Please contact your administrator for more information."

Our org has about 508 fields total, but the number of fields we are currently versioning is about 130. So we are pretty far away from the limit of fields, in the package itself.

The command we run to get into the error:

sfdx force:package:version:create -p sf-common --definitionfile config/project-scratch-def.json -d force-app -k Password1234 --wait 10 -v DevHub

Some other features we have enabled in the definition file:

"features": ["StateAndCountryPicklist","PersonAccounts","ProductsAndSchedules",
                "LiveAgent","ContactsToMultipleAccounts","Communities",
                "EinsteinBuilderFree","AddCustomRelationships:10"],

2 Answers 2

2

Which Edition is your scratch org configured as?

Group, Essential, and Professional each have a limit of 100 custom fields per custom object, which sounds like it may be a likely culprit

Enterprise has a 500 custom field limit (which can be raised to 800 with a case to support)

Unlimited has an 800 limit (which is the max limit possible, can't be increased and packaged fields count towards this limit)

Source:

https://help.salesforce.com/articleView?id=sf.overview_limits_general.htm&type=5

1
  • It was set to Developer. I have tried using Enterprise, it also threw an error. Unlimited doesn't seem to be an available edition option for the scratch org definition. I have also tried with "Partner Developer", "Partner Enterprise" and "Partner Professional", but this all threw an error such as An unexpected error occurred. Please contact Salesforce Support and provide the following error code: 647401461-55859 (-629443337). I have reached out to Salesforce to see if they can help with this. However, getting back to your answer, just "Enterprise" itself doesn't seem to work. Commented Mar 3, 2021 at 22:54
2

The solution, provided by the Salesforce support, was to create an org shape:

https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_shape_create_shape.htm

An org shape creates a scratch org that mimics your Dev Hub edition. After creating an org shape, removing "edition" from the project definition file and its features, we were able to work around the "reached maximum number of custom fields: Either you or your organization has exceeded the maximum number of custom fields allowed in the system. Please contact your administrator for more information." error

You must log in to answer this question.

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