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

Same formula compiles to different lengths on different SF instances, giving formula too big error!

Hi there, not sure if anyone has run into this one. I have been doing some work on my developer instance (na3) to create a formula.

if( Forecast_Period__c = "90", case( Probability , 1, 1, 0.9, 1, 0.8, 0.9, 0.7, 0.8, 0.6, 0.7, 0.5, 0.6, 0.4, 0.5, 0.3, 0.4, 0.2, 0.3, 0.1, 0.3, 0, 0, 0), if( Forecast_Period__c = "60", case( Probability , 1, 1, 0.9, 0.9, 0.8, 0.8, 0.7, 0.7, 0.6, 0.6, 0.5, 0.5, 0.4, 0.4, 0.3, 0.3, 0.2, 0.2, 0.1, 0.1, 0, 0, 0), if( Forecast_Period__c = "30", case( Probability , 1, 1, 0.9, 0.9, 0.8, 0.7, 0.7, 0.5, 0.6, 0.3, 0.5, 0.1, 0.4, 0.1, 0.3, 0.1, 0.2, 0, 0.1, 0, 0, 0, 0), 1)) )

This compiles to 1,597 chars, which works fine as it's under the 4k limit. However I then cut and paste to my client's SF instance (emea) and the exact same formula, exact same field names, compile to 18,197 characters! I have re-compiled the formula in the developer instance and it's still fine, so not sure what would be causing this one. It's really driving my nuts as everything else - field names, numbers, the browser, it's all the same!

Anyone else come across this seemingly bizarre issue?


I am not sure,the reason might be to do with the number of opportunities you have.Might be the formula has to run through more records in your client's instance than compared to your developer's instance.

So where exactly do you want to have this field?could you post some info about the custom fields involved?

Another way of solving this problem ,is to write the formula of this field,using the update fields option present in the work-flow rules.The advantage of this process is that ,you could have many formula rules on one field.So you could split the formula..


Is Forecast_Period__c a formula field?  Perhaps its definition is different in your org and the client's org.

Thanks for your replies - EricB had it correct, the Forecast_Period__c was also a formula field which was different. The whole of the forecast period formula was obviously being compiled into the likelihood field also, giving the large number of compiled chars.

We got around this by using workflow to update a text field with forecast period, meaning that the likelihood formula field was dpending on a particular field value, not on a calculated value.