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
Felipe FernandesFelipe Fernandes 

formula to big

I have 8 formula fields and 1 field wich plus each one of the 8 fields and give a final result. and I have other field that you can edit and put a number for example...

What I have to do: A field that is filled with the first field if the value of the first field is <> 0 or with the second field if value of the first field is = 0.

I got an error because this formula have 8000 characters. Can I do something? Workflow rules can help me? How?

Hope to hear more.

Steve :-/Steve :-/

ouch!  8,000 Char is gonna be REALLY tough... (you have to get it under 5,000)  

Can you post all of the formulas that you're using?  It has to be all of them because the 8,000 is from the combined total.  


But I gotta tell you up front that getting from 8K down to 5K ain't gonna be easy, and may not even be possible.

Felipe FernandesFelipe Fernandes

I think is not possible, but i hope u can help me... :P



VltTabFab1__c * (1+ Linha__r.IPI__c )*(1+ Linha__r.Frete__c )*(1- Linha__r.Desc1__c )*(1- Linha__r.Desc2__c )*(1- Linha__r.Desc3__c )*(1- Linha__r.Desc4__c )*(1- Linha__r.DescAcresFin__c )* (1+ Linha__r.Mark_up__c )*(1+ Linha__r.Plano_de_Pagamento_padr_o__c )*( Quantidade__c )



Explaining: I have an object and products are conected to this object, like a brand and products of this brand. In this object i have fields wich tells discounts and other things, the formula get the value of this fields. I have 8 fields with this formula and 1 field (total price) wich get the final result of this 8 fields and give me the final price.

Today i get the value in a simple field but i need a field that get the value from "total price" and use the simple field only if "total price" is blank, but when i do this formula field i have the problem...

I can't do that  using workflow rules or some other way? just need a condition to get the result of a field...




Steve :-/Steve :-/

The problem is that some of the fields that you are referencing in your formula are also using a formula.  

The following limits apply to formula fields:

  • Character limit—Formula fields can contain up to 3,900 characters, including spaces, return characters, and comments. If your formula requires more characters, create separate formula fields and reference them in another formula field.
  • Save size limit—Formula fields cannot exceed 4,000 bytes when saved. The save size differs from the number of characters if you use multi-byte characters in your formula.
  • Compile size limit—Formula fields cannot exceed 5,000 bytes when compiled. The compile size is the size of the formula (in bytes) including all of the fields, values, and formulas it references. There is no direct correlation between the compile size and the character. Some functions, such as TEXT, DATEVALUE, and DATE significantly increase the compile size.

The only way that I know of to get around this is to implement a workflow with field updates.  for the formulas that are being referenced, you need to convert those to text fields (or number fields depending on the type) and then have a workflow fire every time the record is created or edited on something like created date <> null.


The actions that you would have on the workflow woudl be the formulas that you already have in place.  Once you have that in place, your final formula can reference those text fields rather than formula fields, thus bringing down your compile size.


Of course this presents a new issue that you need to go back and populate all of the data in the text fields because it will remain empty until the record is edited and the workflow fired.


to illustrate what I mean above, assume you have these formulas:


Formula1__c = (field1__c + field2__c)

Formula2__c = (field3__c + Formula1__c)


Well, Formula2__c actually expands out to be (field3__c +(field1__c + field2__c))


But if you update Formula1__c to be a text field that gets updated by workflow then Formula2__c doesn't "Expand"


Good luck.