5

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.

1

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.

6
  • the term "phantom org" and the mechanics behind the scenes seem not to be very public. I couldn't find any reference or documentation. Is the process anywhere described or is there any further information available? we have seen unlocked packages as a huge chance, but found a lot of very strange behavior involved, such as test code coverage of packages is not counting for the org.
    – Uwe Heim
    May 4 at 19:07
  • @UweHeim It's not any special terminology. It's just a temporary org that is created for the unique purpose of validating the metadata, and is then freed afterwards. It's similar to a Scratch Org, but will never be logged in to by a human.
    – sfdcfox
    May 4 at 21:14
  • I have two fields that generate the two exact errors if I delete one of them the error got away and I stay with one error that is similar to what I posted so I am sure that the formula field is causing this. Also I am assuming that a feature activation using the def file might be required if it isn't a bug but I have logged a case for this to make sure. May 6 at 9:30
  • @MohamedHousseinDouici Still sounds like a bug, presuming you can have both fields in your org at once, yet not deploy this package version. Hopefully they have a workaround for you besides "build two packages."
    – sfdcfox
    May 6 at 11:55
  • @sfdcfox so I reached out to support and apparently the problem is within the formula field and the compiled size displayed on the UI from CLI because when I am packaging the formula field Field_A__c is replacing the other formula field Field_B__c used within it and as Field_B__c contains some functions which increase the overall compiled size, it leads to the error. I assume that when I do "Check Syntax" on Field_A__c on the UI what I see is the compiled size without counting the used formula fields. I should try to reduce the formula field and see if the problem gets resolved. Jun 10 at 11:57

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.