1

I'm using the C# Mustache template syntax (used by Journey Builder) to create Data Binding templates. I've tested the if tag and that works really well, but I can't figure out the syntax to use for the each tag.

I'm testing this by setting the arguments object in a DataExtensionUpdate (Update Contact Data) Activity to update a Data Extension with Attribute values from an Attribute Group. Here's what my arguments object looks like:

"arguments": {
"contactKey": "{{Contact.Key}}",
"value": "{{#each Contact}}{{Attribute.Members.Firstname}} {{Attribute.Members.Lastname}}, {{Attribute.Members.Company}}{{/each}}"
},

This is an alternative to declaring the fully qualified attribute name for each placeholder tag (which does work):

"arguments": {
    "contactKey": "{{Contact.Key}}",
    "value": "{{Contact.Attribute.Members.Firstname}} {{Contact.Attribute.Members.Lastname}}, {{Contact.Attribute.Members.Company}}"
},

I'd expect the Data Extension to be updated to with the Member Firstname Lastname and Company, for example:

Sam Sample, Sample Company

I've tried different variations of the each syntax, including:

{{#each Contact.Attribute.Members}}{{Firstname}} {{Lastname}}, {{Company}}{{/each}}

And

{{#each Contact.Attribute}}{{Members.Firstname}} {{Members.Lastname}}, {{Members.Company}}{{/each}}

And

{{#each Contact}}{{Attribute.Members.Firstname}} {{Attribute.Members.Lastname}}, {{Attribute.Members.Company}}{{/each}}

With each syntax, the Contact fails at this Activity in the Interaction and I can see (using my browser Inspector) that there is an issue with the syntax:

Result-> Status = [Fail] Error: [ExactTarget.InteractionStudio.Engine.DataBoundException: ExactTarget.JourneyBuilder.Activities.DataExtensionUpdateActivity.Value: Error binding data bound member. ---> ExactTarget.InteractionStudio.Binding.EvaluatedExpressionException: Error rendering required expression [{{#each Contact}}{{Attribute.Members.Firstname}} {{Attribute.Members.Lastname}}, {{Attribute.Members.Company}}{{\\/each}}] value [] to data type [System.String]

at ExactTarget.InteractionStudio.Binding.Evaluators.ExpressionEvaluator.Evaluate[T](String expression, WorkflowContext context, Activity activity, Boolean optional)

at ExactTarget.InteractionStudio.Workflow.Activities.Binding.DataBound`1.DataBind(IExpressionEvaluator evaluator, WorkflowContext context, Activity activity, Boolean optional)

at ExactTarget.InteractionStudio.Engine.EngineImpl.<>c__DisplayClass9.<BindData>b__8()

--- End of inner exception stack trace ---

at ExactTarget.InteractionStudio.Engine.EngineImpl.<>c__DisplayClass9.<BindData>b__8()
at ExactTarget.Diagnostics.StatsCollection.RecordMetric(String[] names, Action action)
at ExactTarget.Diagnostics.Stats.Time(String tag, Action action)
at ExactTarget.InteractionStudio.Engine.EngineImpl.Process(EngineInstanceInfo instanceInfo)]

Can someone confirm if the each Mustache tag is supported by the Journey Builder engine?

1

It appears that the each tag is not supported, which after thinking this through makes sense as this would theoretically render values for each record in the Data Extension. To achieve what I wanted to do, I changed to the with tag and this works correctly:

"arguments": {
    "contactKey": "{{Contact.Key}}",
    "value": "{{#with Contact.Attribute.Members}}{{Firstname}} {{Lastname}}, {{Company}}{{/with}}"
},

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.