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
Chris GoderieChris Goderie 

Is there a limit in the size of a workflow formula when doing a field update rule?

Hello,

I am trying to create a workflow formula on the account object to have a custom text-field called Region getting updated based on the BillingCountry field value of the account. First tried this with a direct formula field but I red somewhere there are limitations to the number of characters or size of the formula that can be maximum used. However when creating the workflow I still get the error: Error, The size of your string is 4.448 bytes but may not exceed 4.000 bytes.

See formula below which are a lot of nested CASES checking for countries we have in Asia, Latin America and North America and if the country is different it will select Europe (which has most of the countries we use).

Any idea why this does not work? The syntax is correct and I thought with workflow there are no limitations in the formula-size.

Thanks,

Chris


CASE(BillingCountry,  "Afghanistan",  "Asia",  "American Samoa",  "Asia",  CASE(BillingCountry,  "Australia",  "Asia",  "Bangladesh",  "Asia",  
CASE(BillingCountry,  "Bhutan",  "Asia",  "Brunei Darussalam",  "Asia",  CASE(BillingCountry,  "Cambodia",  "Asia",  "China",  "Asia",  
CASE(BillingCountry,  "Cook Islands",  "Asia",  "Fiji",  "Asia",  CASE(BillingCountry,  "French Polynesia",  "Asia",  "Guam",  "Asia",  
CASE(BillingCountry,  "Hong Kong",  "Asia",  "India",  "Asia",  CASE(BillingCountry,  "Indonesia",  "Asia",  "Japan",  "Asia",  
CASE(BillingCountry,  "Kiribati",  "Asia",  "Korea, Democratic People's Republic of",  "Asia",  CASE(BillingCountry,  "Korea, Republic of",  "Asia",  "Lao People's Democratic Republic",  "Asia",  
CASE(BillingCountry,  "Macao",  "Asia",  "Malaysia",  "Asia",  CASE(BillingCountry,  "Maldives",  "Asia",  "Marshall Islands",  "Asia",  
CASE(BillingCountry,  "Micronesia, Federated States of",  "Asia",  "Mongolia",  "Asia",  CASE(BillingCountry,  "Myanmar",  "Asia",  "Nepal",  "Asia",  
CASE(BillingCountry,  "New Caledonia",  "Asia",  "New Zealand",  "Asia",  CASE(BillingCountry,  "Niue",  "Asia",  "Norfolk Island",  "Asia",  
CASE(BillingCountry,  "Northern Mariana Islands",  "Asia",  "Pakistan",  "Asia",  CASE(BillingCountry,  "Palau",  "Asia",  "Papua New Guinea",  "Asia",  
CASE(BillingCountry,  "Philippines",  "Asia",  "Samoa",  "Asia",  CASE(BillingCountry,  "Singapore",  "Asia",  "Solomon Islands",  "Asia",  
CASE(BillingCountry,  "Sri Lanka",  "Asia",  "Taiwan, Province of China",  "Asia",  CASE(BillingCountry,  "Thailand",  "Asia",  "Timor-Leste",  "Asia",  
CASE(BillingCountry,  "Tokelau",  "Asia",  "Tonga",  "Asia",  CASE(BillingCountry,  "Tuvalu",  "Asia",  "Uzbekistan",  "Asia",  
CASE(BillingCountry,  "Vanuatu",  "Asia",  "Viet Nam",  "Asia",  CASE(BillingCountry,  "Wallis and Futuna",  "Asia",  "Antigua and Barbuda",  "Latin America",  
CASE(BillingCountry,  "Argentina",  "Latin America",  "Aruba",  "Latin America",  CASE(BillingCountry,  "Bahamas",  "Latin America",  "Barbados",  "Latin America",  
CASE(BillingCountry,  "Belize",  "Latin America",  "Bermuda",  "Latin America",  CASE(BillingCountry,  "Bolivia",  "Latin America",  "Brazil",  "Latin America",  
CASE(BillingCountry,  "Caribean",  "Latin America",  "Cayman Islands",  "Latin America",  CASE(BillingCountry,  "Chile",  "Latin America",  "Colombia",  "Latin America",  
CASE(BillingCountry,  "Costa Rica",  "Latin America",  "Cuba",  "Latin America",  CASE(BillingCountry,  "Dominica",  "Latin America",  "Dominican Republic",  "Latin America",  
CASE(BillingCountry,  "Ecuador",  "Latin America",  "El Salvador",  "Latin America",  CASE(BillingCountry,  "French Guiana",  "Latin America",  "Grenada",  "Latin America",  
CASE(BillingCountry,  "Guadeloupe",  "Latin America",  "Guatemala",  "Latin America",  CASE(BillingCountry,  "Guyana",  "Latin America",  "Haiti",  "Latin America",  
CASE(BillingCountry,  "Honduras",  "Latin America",  "Jamaica",  "Latin America",  CASE(BillingCountry,  "Martinique",  "Latin America",  "Mexico",  "Latin America",  
CASE(BillingCountry,  "Netherlands Antilles",  "Latin America",  "Nicaragua",  "Latin America",  CASE(BillingCountry,  "Panama",  "Latin America",  "Paraguay",  "Latin America",  
CASE(BillingCountry,  "Peru",  "Latin America",  "Puerto Rico",  "Latin America",  CASE(BillingCountry,  "Saint Kitts and Nevis",  "Latin America",  "Saint Lucia",  "Latin America",  
CASE(BillingCountry,  "Saint Vincent and The Grenadines",  "Latin America",  "Suriname",  "Latin America",  CASE(BillingCountry,  "Trinidad and Tobago",  "Latin America",  "Turks and Caicos Islands",  "Latin America",  
CASE(BillingCountry,  "Uruguay",  "Latin America",  "Venezuela, Bolivarian Republic of",  "Latin America",  CASE(BillingCountry,  "Virgin Islands, British",  "Latin America",  "Virgin Islands, U.S.",  "Latin America",  
CASE(BillingCountry,  "Canada",  "North America",  "United States",  "North America",  "Europe")))))))))))))))))))))))))))))))))))))))))))))))))
Himanshu ParasharHimanshu Parashar
Hi Chris,

Yes this is limit of fomula, 3900 limit is there. I once encounter this problem and I had to move code in trigger. Please find following links for reference
 
https://help.salesforce.com/apex/HTViewSolution?urlname=Formula-field-exceeds-maximum-number-of-characters-1327109401516&language=en_US

Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S.  If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
David ZhuDavid Zhu
I would suggest put the condition in four workflow rules. Each workflow rule for countries in one continent, namly,Asia,Latin America, North America and Europe.
Chris GoderieChris Goderie
Hello David, I tried that but the problem is that when using CASE ther is always an "Else_Result" . I created 1 workflow with multiple field-update rules, 1 for Asia, 1 for Latin America and 1 for North America with Europe as "Else_result" for each formula but this does only work for the last field_update rile (North America). So it seems when the CASE is true it still continues all other field-update rules. Maybe you can show me the syntax you had in mind? Thanks Chris
Amrit Patil 18Amrit Patil 18

What himanshu is saying above is incorrect. Workflow Field update formula field do not have the same 5000 char compiled formula limit as a normal formula field on an object. so whenever you want to circumnavigate the 5000 limit issue for formulaes , use the same formula in a workflow and update that field.