function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gregj777gregj777 

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

I have created a timecard object to calculate hours for an employee. The employee would submit hours based on Time/Date value entered and what Pay_type (Regular, Stat, Vac, Sick). The formula then sums each pay type. But now I want to TOTAL SUM ALL HOURS but its giving me an "Compiled formula is too big to execute (9,517 characters). Maximum size is 5,000 characters".

Anyone have any suggestion on how to go about decreasing the character size of the formula below OR a better way to TOTAL ALL HOURS.

 

 

IF( ISPICKVAL( Pay_Type_Mon__c , "Regular"), FLOOR ( MOD( End_Time_Monday__c - ($System.OriginDateTime),1) *24) - FLOOR ( MOD( Start_Time_Monday__c - ($System.OriginDateTime),1) *24) -0.5, 0 ) + 
IF ( ISPICKVAL( Pay_Type_Tues__c, "Regular"), FLOOR ( MOD( End_Time_Tuesday__c - ($System.OriginDateTime),1) *24) - FLOOR ( MOD( Start_Time_Tuesday__c - ($System.OriginDateTime),1) *24) -0.5, 0 ) + 
IF ( ISPICKVAL( Pay_Type_Wed__c, "Regular"), FLOOR ( MOD( End_Time_Wednesday__c - ($System.OriginDateTime),1) *24) - FLOOR ( MOD( Start_Time_Wednesday__c - ($System.OriginDateTime),1) *24) -0.5, 0 ) + 
IF ( ISPICKVAL( Pay_Type_Thurs__c , "Regular"), FLOOR ( MOD( End_Time_Thursday__c - ($System.OriginDateTime),1) *24) - FLOOR ( MOD( Start_Time_Thursday__c - ($System.OriginDateTime),1) *24) -0.5, 0 ) + 
IF (ISPICKVAL( Pay_Type_Fri__c, "Regular"), FLOOR ( MOD( End_Time_Friday__c - ($System.OriginDateTime),1) *24) - FLOOR ( MOD( Start_Time_Friday__c - ($System.OriginDateTime),1) *24)-0.5, 0) + 
IF (ISPICKVAL( Pay_Type_Sat__c, "Regular"), FLOOR ( MOD( End_Time_Saturday__c - ($System.OriginDateTime),1) *24) - FLOOR ( MOD( Start_Time_Saturday__c - ($System.OriginDateTime),1) *24)-0.5, 0) + 
IF (ISPICKVAL( Pay_Type_Sun__c, "Regular"), FLOOR ( MOD( End_Time_Sunday__c - ($System.OriginDateTime),1) *24) - FLOOR ( MOD( Start_Time_Sunday__c - ($System.OriginDateTime),1) *24)-0.5, 0)

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

If possible, make the field a regular field, and use a Workflow Field Update instead. They are not bound to the limitations of formulas, but do not run in real time (i.e. you will need to run the data loader once against all existing records).

All Answers

sfdcfoxsfdcfox

If possible, make the field a regular field, and use a Workflow Field Update instead. They are not bound to the limitations of formulas, but do not run in real time (i.e. you will need to run the data loader once against all existing records).

This was selected as the best answer
gregj777gregj777

Thank you. That's what I did and it worked great.

naypersnaypers

Thank you!!

helloNYChelloNYC

How do you set up a Workflow Field Update?

 

I haven't been able to fine Workflow in Setup, Create...

 

Could you possibly give me a step-by-step setup for this?

 

Thank you,

Alexander