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
Santiago GMZSantiago GMZ 

Create a trigger to calculate values


I have one formula field that has reached teh 5k character limit and still need it to do some extra calculations. 

I reached out Salesforce Support for gudance, but only received a create an apex trigger to run teh calculation, also that they donot help to do any custom coding. 

I know my way with Flows, formulas and validation, but in APEX I consider myself a NOOB . Can somebody if you can help me. 

The thing is that the prevoiousAdmin created a Duplciate field

ACV & ACV (WPS) Mainly both fields calculate the same value but using diferent parameters depending of teh Opportunity record type. 

They are set up in the following Matter:
Custom Field ACV__c type currency 

IF ( RecordType.Name  <> "WHP - Opportunity",  ACV_WPS__c , 
(Contract_term_months__c > 0) && (Contract_term_months__c < 12),
Final_MCV_number__c *Contract_term_months__c ,
Final_MCV_number__c *12)
ISPICKVAL(Type,'NCL - Nouveau Client'),
ISPICKVAL(Type,'E - Extension'),
ISPICKVAL(Type,'L - Nouvelle Ligne de Produits')),

I tried to merge Both Fields inti a single one (ACV) but received the alert of maxium characters limit. 

Obuusly the expression "IF ( RecordType.Name <> "WHP - Opportunity", ACV_WPS__c , " is not longuer needed.

Any ideas? suggestions, example coding ? 

Thanks a lot!!!


Hi Santiago, 

Per my knowledge SF includes the characters of other formula fields too if you use them within the formula. ( i.e if you use a formula Age__c > 10) and Age__c itself has 5k characters, it will end up giving you an error. 

On workaround to number of characters is to use Process builder to update your (Text/Number or whatever return type of formula you have ) on the object once your record is edited. The formula character limit doesnt cause a problem in process builder as such. 

I suggest you combine your formulas in a Process builder and update your result field. 

Let me know if it helps you.