Error: Compiled Formula is too Big to Execute (13,831 characters) Maximum Size is 5000 Characters in BMC Helix Remedyforce

Version 3
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    BMC Helix Remedyforce Service Desk


    Occasionally Salesforce’s formula compile size limit is hit when creating Formula fields on objects. A message similar to, “Compiled formula is too big to execute (13,831 characters). Maximum size is 5,000 characters,” will occur, even though you have not reached the limit.


    Compile size hit limit


    There are a few Workarounds to this problem in Salesforce Formula fields

    • Use Algebra

    Many times a formula will reference other formulas. actually pulls in all the sub-formulas into one big statement before processing. Therefore, multiple nesting of formulas can cause an explosion in size. One effective solution is to use algebra if a sub-formula is referenced more than once. For example, a 25% discount can be calculated by:


    Final Price = Sales Price - Discount * Sales Price
    Sales Price = 90% * List Price, and
    Discount = 25%


    Sales Price is used twice in the Final Price formula. Algebra can be used to rewrite the formula so that it is referenced once:


    Final Price = Sales Price * (100% - Discount)

    • Use CASE Instead Of Nested IFs
    There are situations where a value is dependent on a text value, such as discounts based on customer type. Many times IF statements are used multiple times for this and these are commonly called “nested IFs.” For example: 

    Discount = IF( Type = "Consumer", 10%, IF( Type = "Reseller", 30%, 0 ) )

    Nested IFs generally result in large compiled sizes. Salesforce provides a CASE statement to accomplish the same thing but with smaller resulting sizes. 

    Discount = CASE( Type, "Consumer", 10%, "Reseller", 30%, 0 )

    A significant limitation of CASE is that it cannot return Boolean (TRUE, FALSE) values, so return 0 or 1 and then wrap a single IF around it to return TRUE or FALSE.  
    • Use Workflow Field Update

    When CASE statements are used with large picklists, it can still overwhelm the limit. A typical scenario would be to translate all the countries in the world to five regions (e.g., North America, Europe, etc.). In situations where the formula is simply too large, Workflow Field Updates can be used (Enterprise and Unlimited Editions only). The formula field for Field Updates has a much larger limit. There is actually no documentation on what the limit is.


    The approach is to:

    1. Create a non-formula field instead of what would normally have been a Formula field on the object     
      • On Page Layouts set this field as Read Only since users should not manually update this field.
      • Field Level Security can also be used if the Default Workflow User has System Administrator privileges
    3. Create a Workflow Rule that will always fire     
      • For the Evaluation Criteria, choose “Every time a record is created or edited”
      • For the Rule Criteria, select “formula evaluates to true”
      • Enter “true” in the formula box
    5. Create a Field Update with a formula to update the field on the object
    7. Any subsequent formulas can reference the populated field

    The main drawback to this solution is when an object has multiple Workflows. does not guarantee the order in which Workflows are evaluated.

    • Use an Apex Trigger

    If all else fails, an Apex Trigger could be implemented (Enterprise and Unlimited Editions only). Programming skills are required to implement Triggers. Triggers are Apex code that run based on the state of a transaction. Typically the state is right after manual updates to the record have been saved to the database.The approach is similar to the outline for Workflow Field Update except substitute a Trigger for the Workflow.The main advantage in this situation is that Triggers are evaluated before Workflows, therefore ensuring that Workflows do not fire before a criteria field has been updated. However, make sure that the Trigger is not dependent on a Workflow firing first.

    • Create a new formula field
       If for some reason you are editing an old formula field, try creating a new field instead, this may solve the compilation issue, seems that old field compiles old formula and then adds in top of it your new entered formula. If you create a new fresh field you may avoid this problem.




    Article Number:


    Article Type:

    Solutions to a Product Problem

      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles