Verification in progress Differs from official docs Test scripts included

Syntax

IsNullDefault(value, defaultValue)  →  string
2 arguments — exactly

Parameters

Name Type Required Description
value string | number | boolean | date Yes Value to test — returned unchanged whenever it is present
defaultValue string | number | boolean | date Yes Fallback to return when the value is missing — in a Next email returned for an undeclared variable, an unset variable and the empty string, without Smart Capture

Example

%%[ VAR @tier ]%%
%%=IsNullDefault(@tier, "DEF")=%%

Renders DEF, because @tier was never set.

%%[ SET @tier = "hello" ]%%
%%=IsNullDefault(@tier, "DEF")=%%

Renders hello.

Return value

string — the value when it is present, otherwise the fallback.

The result is whatever the caller passes in, so there is no fixed set of values to test for.

Behaviour

Unset and empty values return the fallback. An undeclared variable, a variable declared with VAR and never set, and a variable set to "" each give DEF. The literal call IsNullDefault("", "fallback") gives fallback.

A number works as the fallback. IsNullDefault(@unset, 42) gives 42.

Present values pass through. "hello", 0, "0" and "false" come back unchanged, whether passed directly or through a variable.

A date passes through in ISO form. IsNullDefault(Now(), "DEF") gives a value like 2026-11-22T20:29:14.

Whitespace is not null. A variable holding spaces does not return the fallback. (The probe wrote three spaces as a literal, which the render collapses to one before AMPscript runs; build runs of spaces with Char(32).)

Request parameters, subscriber attributes and Smart Capture forms were not tested in Next.

Show Next test script
<!-- Marketing Cloud Next test script for IsNullDefault. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[fallback] got=[%%=IsNullDefault("","fallback")=%%]</p>
<p>c2 expect=[hello] got=[%%=IsNullDefault("hello", "DEF")=%%]</p>
<p>c3 expect=[0] got=[%%=IsNullDefault(0, "DEF")=%%]</p>
<p>c4 expect=[hello] got=[%%[ SET @r2dval = "hello" ]%%%%=IsNullDefault(@r2dval,"DEF")=%%]</p>
<p>c5 expect=[DEF] got=[%%=IsNullDefault(@r2d_never_declared,"DEF")=%%]</p>
<p>c6 expect=[DEF] got=[%%[ VAR @r2du ]%%%%=IsNullDefault(@r2du,"DEF")=%%]</p>
<p>c7 expect=[DEF] got=[%%[ SET @r2des = "" ]%%%%=IsNullDefault(@r2des,"DEF")=%%]</p>
<p>c8 expect=[ ] got=[%%[ SET @r2dsp = "   " ]%%%%=IsNullDefault(@r2dsp,"DEF")=%%]</p>
<p>c9 expect=[0] got=[%%[ SET @r2dz = 0 ]%%%%=IsNullDefault(@r2dz,"DEF")=%%]</p>
<p>c10 expect=[0] got=[%%[ SET @r2dz0 = "0" ]%%%%=IsNullDefault(@r2dz0,"DEF")=%%]</p>
<p>c11 expect=[false] got=[%%[ SET @r2dsf = "false" ]%%%%=IsNullDefault(@r2dsf,"DEF")=%%]</p>
<p>c12 expect=[2026-11-22T20:29:14] got=[%%=IsNullDefault(Now(),"DEF")=%%]</p>
<p>c13 expect=[42] got=[%%[ VAR @r2ddn ]%%%%=IsNullDefault(@r2ddn,42)=%%]</p>

Differs from official docs

  • It works in Next although the docs say it does not. The official availability table marks IsNullDefault as unsupported in Marketing Cloud Next and ties it to Smart Capture forms. In a Next email it works on ordinary variables: an unset or empty value returns the fallback. Card

Availability & differences

PlatformAvailable
Marketing Cloud EngagementYes
Marketing Cloud NextYes, from API 68.0

See also