ExactTarget - How to add dynamic user created content in an Email Template

793 views Asked by At

We have an email currently being created in back end code (C#) and sent through the ExactTarget API. I want to move this into a template in ExactTarget so that we don't have to maintain HTML written in StringBuilder() in C#. The issue is the content of the email is determined by what a user inputs. The user fills out a form of what samples they want then an email is sent to a person to fulfill the order.

So an example would be:

<tr>
    <td>Product Number</td>
    <td>Quantity</td>
</tr>
<tr>
    <td>Product Number</td>
    <td>Quantity</td>
</tr>

The maximum number of samples that can be ordered is 16. Is there a way to loop through content posted to ExactTarget to create the correct number of rows instead of hard coding 16 rows into the template and half of them being blank.

Please let me know if I need to be more specific about anything

2

There are 2 answers

1
Sravan On

You try just creating a Partial View as below,

@model IEnumerable<CartItems>
<table>
@foreach(var item in Model)
{
    <tr>
    <td>@item.Number</td>
    <td>@item.Quantity</td>
    <tr>
}
</table>

Call it from your C# Code as He suggested Here. Render a view as a string

0
RyanY On

As jordanm mentioned, here is an example in the ExactTarget documentation that covers this. You pass the custom input as XML during your triggered send and parse it / inject it into the HTML with AMPscript.

http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript/using_ampscript_with_the_web_service_api/passing_content_to_a_triggered_send_message_at_send_time/