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
Tyler Nguyen 7Tyler Nguyen 7 

I am getting an error when comparing two dates

I am trying to compare two dates to get the more recent date of the two dates and i am getting the following error message:

Error: Compiled formula is too big to execute (7,617 characters). Maximum size is 5,000 characters
logontokartiklogontokartik
You need to optimize your formula as there is a limit of max  5000 characters. Remove all the empty spaces and try compressing. Please post your formula so that we can find where the issue is
KaranrajKaranraj
As Karthik said, yes there is complie size limit for formula field in salesforce. Can try the below formula for your scenario, Just replace the Create Date and Lastmodified date with your field name

IF( CreatedDate >  LastModifiedDate , CreatedDate , LastModifiedDate )


David "w00t!" LiuDavid "w00t!" Liu
You might be referencing fields in your formula that are formula fields themselves, which counts towards your size limit.

In that case, try changing some of the formulas to workflow rules with the same criteria!  This resets the size limit!