[SalesForce] Formula field is too big to execute (5,480 characters)

I got an error when i am trying to add fomrula in formula field.

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

My formula is

(ED__c+Service_Tax__c+Total_Site_Work_Price1__c+Total_Selling_Price_Based_on1__c )*WCTper__c

In this formula ED__c, Total_Site_Work_Price1__c, Total_Selling_Price_Based_on1__c are also Formula fields. And these formulas are also contain fomrula fields.

How can i calculate the formula..?

Best Answer

As others have pointed out, the compile size for a given formula includes the compile sizes for other formulas that it has referenced. The additive nature of compile size is causing you to exceed the limit with this one.

Without seeing the content in your other formulas, it's hard to say exactly what's causing the large compile size. Before you leap to Apex, it's worth a look to see if your formulas are written as efficiently as possible (which is a good practice anyway). There is a doc from Salesforce on this very topic, Tips for Reducing Formula Size, which has a number of suggestions and examples:

  1. Minimize the number of references to other fields
  2. Minimize the number of times formula functions are called
  3. Rethink your picklist
  4. Think about the problem another way
  5. If all else fails, use a workflow field update (or trigger)

Your biggest win will be reducing formulas that are referenced multiple times.

Related Topic