2

I want to use GTL with Journey Data and Contact Data to personalize an Email with information stored in Contact Builder and information coming from an API event triggered by an external system. I am trying to do basic personalization to display an attribute for both cases.

{{Contact.Attribute.Attribute_Set.Attribute_Name}}
{{Event.APIEvent-xxxx-xxxxx-xxxxx.CustomEventAttribute}}

Data Relationships were configured only in Contact Builder for Contact Data and the appropriate Event was created also in Data Designer. These codes are added inside an Email without any AMPScript. I am wondering why my code isn't working.

1 Answer 1

0

As far as I know (and have experienced), GTL doesn't work in Content Builder emails.

If you need to parse JSON, I'd recommend doing it with SSJS:

<script runat="server">
Platform.Load("Core","1.1.1");

var json = Attribute.GetValue('json');
var jsonObj = Platform.Function.ParseJSON(json);

if (jsonObj.length > 0) {

  for (var i = 0; i < jsonObj.length; i++ ) {

      var item = jsonObj[i];

      Platform.Variable.SetValue("@sku",item['sku']);
      Platform.Variable.SetValue("@name",item['name']);
      Platform.Variable.SetValue("@url",item['url']);

      </script>

      <br>%%=v(@sku)=%% - <a href="%%=redirectto(@url)=%%">%%=v(@name)=%%</a>

      <script runat="server">

  }

} else {

  Write("no products found")

}
</script>
3
  • Hi Adam, thanks for your reply. All I want to do is personalize an Email with Journey Data triggered from an external system with /contactEvents route. I want to access this data directly in the Email using {{Event.APIEvent-xxxx-xxxxx-xxxxx.CustomEventAttribute}} but you're saying that GTL in general is not working in Content Builder..
    – zeljazouli
    Commented Jul 10, 2017 at 13:52
  • If you're not parsing JSON, then I'd still recommend sticking with AMPScript. I'd stay away from GTL in Content Builder emails.. Here's a good post on how to reference the fields with AMPScript. Commented Jul 10, 2017 at 13:58
  • The post you're mentioning is explaining how to retrieve event data from a Salesforce Data Event. I am wondering how can I retrieve the Data from an API Event : I think I need to have the EventInstanceID in a variable so I can retrieve the Event Data from the Event DE using AMPScript.. but I have no clue on how to have the EventIstanceID in my Email.
    – zeljazouli
    Commented Jul 10, 2017 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .