Loading

Use coalesce() function in CRM Analytics to replace null values

게시 일자: Mar 18, 2026
상세 설명
Null values can cause problems in recipe custom formula transformations or dashboard SAQL function.

Errors may show references to a Null value or NullPointerException which is a runtime exception that occurs when a variable is accessed which is not pointing to any value and refers to nothing or null.

In Data prep recipe custom formula transformations, it may manifest as an Error ID: 2000 error.
솔루션
In CRM Analytics, the coalesce() function can be used to check and replace nulls with any value or an empty string. 

In the below example, coalesce() is used to check if the field (first parameter) is null and replaces it with whatever value provided in the second parameter. To learn more about the coalesce() function, refer to the developer docs.
coalesce("fieldApiName",'defaultValue')
General format when used within another function: 
function_name(coalesce("fieldApiName",'defaultValue'))
In CRM Analytics recipes, for example, you may have a transformation with a custom formula using the array() multivalue function.

array(field1,field2) - Returns a multivalue containing field1, field2 

If any of the field values is null, the recipe may fail at runtime.

array(fieldName, 

Used with coalesce():
array(coalesce("fieldApiName1", ''))

if there are multiple fields

array(coalesce("fieldApiName1", ''), coalesce("fieldApiName2", ''))

NOTE: Make sure you use the API name of the column/field, not the label.

For more information on multivalue functions, see our documentation: Multivalue Functions for Formulas .
Knowledge 기사 번호

000395599

 
로드 중
Salesforce Help | Article