Creating a Journey Builder log with Data Binding in the Update Contact activity

Data Binding

Let’s assume you want to introduce some basic logging in your journeys and would want to write who entered a particular path.

There’s no communication on that path and you don’t want to rely on code running while the message is prepared (some people may be opted-out after all), so you turn your gaze to the Update Contact activity and start wondering how to use it for this case.

The way the Update Contact activity in Journey Builder presents itself is pretty humble – it seems like it can’t assign any dynamic values and can only write hard-coded values to the DE you select.

Why would anyone want to write only the same values for everyone is beyond me. Nevertheless it’s possible to make this activity write personalized values from both the Contact and Journey, but it’s tricky.

To make this happen we need to utilize what is described as data binding which will allow you go grab data from:

  • Journey (entry) data, but be aware this data does not change as is frozen in time and represents the state in which the data was when the customer entered the journey
  • Contact data – real-time user data from attribute groups from the contact model in Contact Builder.

Contact Data

To grab this type of data you need to follow this pattern: 

For example if you want to get the Subscriber / Contact Key, you would need to use: {{Contact.Attribute."Contact"."Contact Key"}},
but only in this instance you could simply use {{Contact.Key}}

Consider this custom attribute group:

Custom attribute group

You can get the ImportantData attribute by typing out: 

The CriticalStuff field can be accessed with 

That’s cool and all, but it’s easy to make mistakes when writing strings like these. Luckily, there’s a trick we can use.

The easy way of grabbing the data

There’s a much easier way of getting this data, when you play around with the interface:

  • Get a text editor open – we’ll be copying and pasting data binding strings (similar to the code shown above)
  • Create a Task or any other SF object block in your journey and start configuring it
  • Click Create New in the Select Action step
  • Choose any field from the list that corresponds to the data type you want to grab
    • Subject is my favorite for text values
  • Select if you want to use Contact or Journey Data
  • Select the value you want to insert with your Update Contact activity
  • The data binding string you want will appear on the left side of the screen below the name of your Sales and Service Cloud Field of choice
Custom attribute group
  • Copy the string into your text editor
  • Repeat the last 3 steps for as many values as you want include in the Update Contact activity, but remember there’s a limit of 5 fields that activity can use
  • Close the Task activity and paste the value(s) you selected into your Update Contact activity

Let’s consider the setup I presented earlier:

Custom attribute group

If we were to choose our LevelTwo data extension as a Data Extension entry source we could get the CriticalStuff field value in two ways:

  • Contact Data: {{Contact.Attribute."LevelTwo"."CriticalStuff"}}
  • Journey Data: {{Event."DEAudience-a33c4f76-f98c-1210-8205-df62800d6778"."CriticalStuff"}}

Grabbing data about the journeys

Data binding can be used to grab context values referring to the journey as well, here are some other examples from the documentation:

  • Default email address or mobile number grabbed by the journey settings:
    • {{InteractionDefaults.Email}}
    • {{InteractionDefaults.MobileNumber}}
  • Journey version number: {{Context.VersionNumber}}

Binding multiple values into one field

I just want to point out the possibility of binding multiple values into one field. You can write something like this:


There might not be a lot of use cases for this, but it’s a way of putting more data into a DE than the 5 values allowed by the Update Contact Activity

* excluding field type and data length

Please Note:
This article was created as part of the #SFMCTipsAndTricksChallenge on LinkedIn started by Michał Rzepka – the members of the SFMC community were asked to share 3 tips about the system.

Lots of people responded already sharing great tips for beginner and advanced developers alike, so make sure to check the tag out.

You can find my two other tips (about using the CloudPagesURL in the SMS context and using console.table for debugging):