salesforcefieldformulaapexsfdc

SFDC - Formula Field Error: Compiled formula is too big to execute (5,228 characters)


I'm trying to build a formula field that will return text. I was wondering if any of you guys have suggestions for slimming down the following formula, or perhaps a workaround. When it compiles I am over the 5K limit by 228 characters! Any help would be greatly appreciated!

Formula in question:

enter image description here I believe the culprit is 'Use_Case_Stamp___c), which returns a date of 'Today()' when 2 out of the 11 possible 'Use Case Checkboxes' are checked.

The formula for 'Use_Case_Stamp__c' is:

enter image description here

The formula for 'Use_Case_Total__c' (pictured above) is: enter image description here

I'm hoping I can fit this into one formula field as opposed to incorporating additional WFR's. Thank you all in advance.

-M


Solution

  • Why not optimize the formula so that you don't have the expensive Use_Case_Stamp___c field occur so many times

    IF( ISBLANK(Use_Case_Stamp___c),
           //Covers your is blank use case
           IF( Days_As_Customer__c > 120, "Not Met", "In Progress"),
           //Is not Blank Use case 
           IF(Days_As_Customer__c > 120,
              IF(Use_Case_Stamp___c > Contract_Start_Date__c + 120, "Metric Met (Late)", NULL),
              // days <= 120
              IF(Use_Case_Stamp___c <= Contract_Start_Date__c + 120, "Metric Met (On Time)", NULL)
           )
      )
    

    That should get you below, if not you may need to use wf to set the sum of those checkboxes to a single field as opposed to a formula which is what I think you are trying to avoid