IsNullDefault

This function is used to return a default value for empty Smart Capture form field values.

When a Smart Capture form is created with Classic Content in Email Studio, AMPscript is automatically generated by the feature to populate the form data into a List or Data Extension. This generated AMPscript can be modified from the Processing tab in the Edit Content dialog.

This function is not used by other Smart Capture form creation methods; for example, Classic Editor or Content Builder in CloudPages.

NOTE: This function is only available with Smart Capture forms. It will not return a null occurrence value when used in a different context.

Arguments

IsNullDefault(1,2)

Ordinal Type Required Description
1 String True Value to return for non-null occurrences
2 String True Value to return for null occurrences

Example

The following code is automatically generated by the Smart Capture form to populate records in a Data Extension.

%%[

set @de_col = CreateObject("APIProperty")
SetObjectProperty(@de_col, "Name", "level")
SetObjectProperty(@de_col, "Value", IsNullDefault(RequestParameter("level"), "standard"))
AddObjectArrayItem(@de, "Properties", @de_col)

]%%

Output

If the level form field value is null or empty when the form is submitted, the field value will be added to the target Data Extension with a value of standard.