Blank vs Null Attribute Values in Expressions
Last Updated:
Overview
This article addresses the behavior in comparison expressions when a profile attribute's content is removed. When an attribute is cleared, it becomes an empty string ("") rather than null. This distinction can cause expressions, such as "less than" comparisons, to evaluate unexpectedly.
Applies To
- API Calls
- User Profile Attributes
- Lifecycle Management
Cause
This behavior occurs because there is a distinction between a null value and a blank (empty string " ") value.
- A null value indicates the attribute has never been populated.
- A blank string (" ") is stored when an attribute was previously populated but its content was later removed.
- API calls can also update non-populated attributes from null to a blank value.
In comparison expressions, a blank string (" ") is treated as a value. This "empty space" value will always evaluate as "less than" any other populated string value.
Solution
To create reliable comparison expressions, explicitly check that the attribute's value is not a blank string. For example, an expression should verify that the value is not " " and is greater than " ".
Verify Attribute State (Null vs. Blank)
- To determine if a custom attribute is null or blank (" "), use an API call.
- Make the following API call, replacing <url> with the environment and <userid> with user-specific values:
GET {{url}}/api/v1/users/{{userid}}
- Review the API response:
- Blank (" "): The attribute is present in the profile object with an empty string value (for example, "customAttribute": "").
- Null: The attribute is not present in the profile object.
