Salesforce Certified Platform Developer free question 2 / 10 · Domain 1: Developer Fundamentals
A formula field has an expression of about 1,500 characters, well under the character limit, yet it cannot be saved because of an error that it exceeds the compile size limit. Which explanation of the cause matches the Help on formula field limits?
- Compile size is determined by the multi-byte characters in the expression, so it is exceeded when the formula contains many of them
- Compile size gets smaller when TEXT or DATEVALUE is used, so the less you use these functions the more likely you are to exceed it
- Compile size counts the fields and formulas the expression references, so it is exceeded when a referenced formula is large
- Compile size is counted as the total of all formulas on the same object, so it is exceeded when there are many other formulas
Show the answer and explanation
Answer: C
Why this is correct
"Formula Field Limits and Restrictions" in the Help says a formula field can't exceed 15,000 bytes when compiled, and that 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 limit. So even when the expression itself is short, referencing a large formula field can exceed the compile size limit.
Why the other options are wrong
"Compile size is determined by the multi-byte characters in the expression, so it is exceeded when the formula contains many of them" … Multi-byte characters make the character count and the byte count differ for the save size, not the compile size. The compile size counts the fields, values, and formulas that are referenced.
"Compile size is counted as the total of all formulas on the same object, so it is exceeded when there are many other formulas" … Compile size is counted for a single formula, including what that formula references. It is not the total of the other formulas on the same object.
"Compile size gets smaller when TEXT or DATEVALUE is used, so the less you use these functions the more likely you are to exceed it" … The Help says functions such as TEXT, DATEVALUE, DATETIMEVALUE, and DATE significantly increase the compile size. Using them does not make it smaller.
Key point
Functions such as TEXT, DATEVALUE, DATETIMEVALUE, and DATE significantly increase the compile size. Multi-byte characters affect the save size, which is also limited to 15,000 bytes. The character limit, the save size limit, and the compile size limit are separate limits, and the name of the error tells you which one you hit.