ContextDataXml

Context Data is part of an advanced feature specific to bulk jobs. By using this feature, you are able to place any XML data of your choosing into the “context” of the content rendering process. This allows you to access the data inside the template in the same way you access data about the email recipient. Context Data offers even more powerful personalization by giving the template author a place to store and reference data that can be used for cross-selling, weekly specials, and other data that can be presented to each recipient based on attributes associated with that particular recipient.

Recipient XML

<RecipientList>
    <Recipient>
        <EmailAddress>joe@myisp.com</EmailAddress>
        <FirstName>Joe</FirstName>
        <HomeCity>ATL</HomeCity>
    </Recipient>
    <Recipient>
        <EmailAddress>jane@myisp.com</EmailAddress>
        <FirstName>Jane</FirstName>
        <HomeCity>DFW</HomeCity>
    </Recipient>
</Recipient>

Context XML

<Specials>
    <Special>
        <DepartureCity>ATL</DepartureCity>
        <DestinationCity>HNL</DestinationCity>
        <Fare>625.00</Fare>
    </Special>
    <Special>
        <DepartureCity>ATL</DepartureCity>
        <DestinationCity>SFO</DestinationCity>
        <Fare>375.50</Fare>
    </Special>
    <Special>
        <DepartureCity>DFW</DepartureCity>
        <DestinationCity>HNL</DestinationCity>
        <Fare>550.25</Fare>
    </Special>
    <Special>
        <DepartureCity>DFW</DepartureCity>
        <DestinationCity>SFO</DestinationCity>
        <Fare>225.00</Fare>
    </Special>
</Specials>

HTML Template

Hello ${Recipient.FirstName},
Here are the fare specials you asked to be alerted about:
<#list Specials.Special as special>
    <#if special.DepartureCity == recipient.HomeCity>
        Destination: ${special.DestinationCity} Fare: ${special.Fare}
    </#if>
</#list>

Results

Hello Joe,
Here are the fare specials you asked to be alerted about:
        Destination: HNL Fare: 625.00
        Destination: SFO Fare: 375.50
Hello Jane,
Here are the fare specials you asked to be alerted about:
        Destination: HNL Fare: 550.25
        Destination: SFO Fare: 225.00