Compiled size of formula field error when using unlocked packages

So I was working on a task to package some metadata using the unlocked packages that I retrieved from an org. Some of the metadata are objects and they have different field types, of them are formula fields.

I retrieved the metadata flawlessly and I made my package then proceeded to make a version that is when I ran into this error.

Compiled formula is too big to execute (5,434 characters). Maximum size is 5,000 characters.

To verify that I went back to the org and checked the field through “Check Syntax” on the edit page of the formula for it to output the compiled size but I have reached 3,900 characters so far.

I assume that the packaging process has a way to check for the compiled size for it to generate such error because on the org itself I do not seem to have the error. I am not sure if this is a bug from Unlocked Packages or I am forgetting something within this process.

Answer

When creating an Unlocked Package, a phantom org is created to validate the metadata. In theory, you should get the same compiled sizes as your source org, but maybe you have extra fields or something in your package that you did not intend. You may need to contact Technical Support and get a bug logged for R&D (if possible) to see what’s going on internally.

Attribution
Source : Link , Question Author : Mohamed Houssein Douici , Answer Author : sfdcfox

Leave a Comment