Null value in AMPscript SET expression causes errors in SMS sends via Journey Builder and REST
Trailblazer Community

Null value in AMPscript SET expression causes errors in SMS sends via Journey Builder and REST

Marketing Cloud Journey Builder , Marketing Cloud API , Marketing Cloud Mobile

Last updated 2021-10-12 ·Reference W-7599216 ·Reported By 6 users

Fixed in version Marketing Cloud Release October 2020

An SMS message containing AMPscript with a SET expression structured in the following way can result in error during processing of the send if the Data Extension field (i.e. FieldName) being referenced contains an empty or null value:
SET @var1= FieldName

This issue is observed when an SMS message send is performed via Journey Builder with a Journey using a Data Extension entry source and an SMS Activity. The same issue also occurs with an API triggered message created in MobileConnect (e.g. using the REST route POST /sms/v1/messageContact/{id}/send).

However, no error occurs when the same SET expression is used in an Outbound send scheduled in MobileConnect.

1. In Contact Builder, create a Data Extension with the following fields:
ContactKey (type Text)
Phone (type Phone)
Locale (type Locale)
FieldName (type Text)

2. Populate DE with a record containing a valid phone number and locale for your account's code. Leave the DEField field empty.

3. In Content Builder, create an SMS Message that contains a SET expression referencing the field FieldName e.g.

This is the message text:
VAR @var1
SET @var1= FieldName

4. Create a Journey in Journey Builder. Select the Data Extension created in Step 1 as the entry source Data Extension. Add an SMS Activity to the Journey and configure it to send the message created in Content Builder in Step 3.

5. Finalize configuration of the Journey and Activate.

The contact(s) in the entry source Data Extension will enter the Journey and appear to move through the SMS Activity on the UI. However, no send will occur due to AMPscript error that is thrown during processing.

As outlined, this issue occurs when a SET expression assigns the value of an AMPscript variable to a DE field that contains an empty or null value. The issue has been observed to not occur when the AMPscript function AttributeValue is used in the SET expression. For example, as follows:

SET @var1= AttributeValue('FieldName')

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.