3

Journey Builder includes a Data Binding feature to bind data in the context of a Contact, Interaction or Event.

This is feature is primarily used for developing Custom Activities or programatically creating Interactions. However, Data Binding can also be used with the Update Contact Data Activity. What this means is that instead of setting a static value in an Update Contact Data Activity, you can retrieve a specific value from an Attribute Set in your Contact Model, or insert data related to the Interaction, or Event.

I'm using this feature to update a field in a Data Extension by retrieving a value from a different Data Extension. I'm using the following string as a value in the Update Contact Data Activity:

{{Contact.Attribute.MemberData.Cont_Member_Pre_Last_Amount}}

MemberData is the Attribute Set name (which is a linked Data Extension in Contact Builder to the Contact Record with a 1:1 relationship) and Cont_Member_Pre_Last_Amount is a field in the Data Extension.

This works; when a Contact reaches the Update Contact Data Activity in a running Interaction, the selected Data Extension field (in the Contact Data Activity) is updated with the value of Cont_Member_Pre_Last_Amount from the MemberData Attribute Set/Data Extension.

So far, so good. However, if there is no value in the Cont_Member_Pre_Last_Amount field, then the Contact fails in the Update Contact Data Activity. We can see this in Contacts Administration; the log shows us that the Activity Failed and it appears that the Contact becomes trapped in the Interaction and cannot progress to other Activities in the Interaction's branch.

Does anyone know how to fix this so that the Update Contact Data Activity does not fail when resulting value from the Data Binding expression is null?

3

We've worked around this issue by using Handlebars block helpers to build a logical test:

{{#if Contact.Attribute.MemberData.Cont_Member_Pre_Last_Amount}}{{Contact.Attribute.MemberData.Cont_Member_Pre_Last_Amount}}{{#else}}0{{/if}}

This now works correctly; if the value of Cont_Member_Pre_Last_Amount field is not empty, then is updates the value of Cont_Member_Pre_Last_Amount in the field, otherwise it updates the value as 0.

Note that while Handlebars is supported in Data Binding, the block helper implementation is slightly different in Journey Builder than the Handlebars documentation. For example, when using the conditional Handlebars block helper in an if/else statement you have to close else tags, so instead of this:

{{#if Contact.Attribute.MemberData.Cont_Member_Pre_Last_Amount}}
   {{Contact.Attribute.MemberData.Cont_Member_Pre_Last_Amount}}
{{else}}
   0
{{/if}}

You have to use:

{{#if Contact.Attribute.MemberData.Cont_Member_Pre_Last_Amount}}
   {{Contact.Attribute.MemberData.Cont_Member_Pre_Last_Amount}}
{{#else}}
   0
{{/if}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.