0

I have only recently started using the salesforce marketing cloud (exact target) to send out emails, so if there's something conceptually wrong with my question, forgive me :).

So let's say I have email - with some text - where I would like to display a list of items in a form of:

Dear %%Name%%. Your items are:
  <table>
    <tr>
      <td> Item one id </td>
      <td> Item one text </td>
    </tr>
    <tr>
      <td> Item two id </td>
      <td> Item two text </td>
    </tr>
  </table>

This email is than sent out as a triggered send via api calls.

To populate this email with data I have created a Data Extension, where I defined a few fields, but I'm stuck on how to define the data for my list. So in this setup, what would be the best way of handling this situation?

I started looking into it and it seems like I can't simply create an array type in my data extension. So I was wondering if maybe I should pass my items in text - either as xml/json serialize -, that I can later on somehow loop through in the email to build up the list?

But I didn't really get anywhere.

Any help is greatly appreciated.

1

Here are two ways to accomplish this with the API.

  1. In your API call, include structured data in an attribute named Whatever__HTML. The __HTML expands the max field length. This data will also be written to the Triggered Send Templated Data Extension you created for your trigger. The structured data payload can be XML or JSON. In the email, you can parse the XML payload with the BuildRowsetFromXML() AMPScript function and iterate through the result-set with a for-loop. Same for a JSON payload except with the parsing and iterating is done with SSJS or GTL. My recommendation would be to use AMPScript, because SSJS is slow and GTL is not documented very well.

  2. Before firing your trigger API call, add the rows to a secondary Data Extension. You can retrieve the data with an AMPScript lookup function and iterate through it in the email.

Update

We generally work with XML payloads (option #1). Here are a couple of screenshots of a Triggered Send Data Extension:

DE columns

XML sample in DE

  • Just out of curiousity: Is the naming of the attribute/field important for any reason? (I understand this is an example, just want to check if it gets validated at any point or not) – Adam Vigh Nov 2 '16 at 14:45
  • Generally no, but the __HTML suffix is a trick for storing > 4000 characters in a field. – Adam Spriggs Nov 2 '16 at 15:12
  • Thanks a lot. I made it work with the XML. Just had some problem with parsing the data, but it's all sorted. Works well. – Adam Vigh Nov 3 '16 at 7:29

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.