1

Is there a way to have custom placeholder values when programmatically sending an email template using a triggered send through the SOAP API? I see in this documentation for personalization strings that you can include placeholder values like %%emailaddr%% that get populated with content when an email is sent.

Is there a way to specify other arbitrary placeholders like %%dog_breed%% when creating an email, and then including dog_breed as an attribute value or something when creating a triggered send with some passed in value? To clarify, this value might be something generated at the time when I want to trigger the email, and is not something you'd find stored in a database.

The only leads I've found were:

  1. The personalization strings mentioned earlier
  2. Data extensions as described here. However, this seems to refer to data you'd expect to find stored in tables, and so might not be the right approach due to fact that I want to generate values at the time of triggering the email, as mentioned above
  3. Something like the HTMLAttributes section mentioned in this documentation.

(As a side note, I am not an account owner, and as they have no developer edition for the marketing cloud, I'm working slightly in the dark here.)

1 Answer 1

5

Yes, you can definitely do this, given you know all the variable names and include them in Triggered Send email and Triggered Send data extension. Here's an example of how to achieve this.

variable passed: firstname

TriggeredSendDataExtension has a column called: firstname

You need to link to that DE when you create a TS definition: enter image description here

Triggered Email body:

Hello %%firstname%% and welcome to our newsletter!

And now you trigger the email, in this example I used WSProxy, but you can use a SOAP envelope or anything else you wish, as long as you pass the attribute and value pairs used in the email:

<script runat="server">       
    var prox = new Script.Util.WSProxy();
    var tsdKey = ''; //provide TS External Key
    var EmailAddress = ''; //pass email address

    var tsd = {
        TriggeredSendDefinition: {
            CustomerKey: tsdKey
        },
        Subscribers: [{
            EmailAddress: EmailAddress,
            SubscriberKey: EmailAddress,
            Attributes: [{
                Name: 'firstname',
                Value: '' //pass firstname value
            }]
        }]
    };
    var res = prox.createItem('TriggeredSend', tsd);      
</script>
10
  • To note, you do not need the field to be included in the Triggered DE, as long as the field is passed in the payload it will be available in the email. BUT, if it is not on the DE, then that data will not be stored and will be 'lost in the nether' meaning SFMC will not retain the full information passed inside the payload. Commented Oct 19, 2019 at 17:37
  • 1
    @Gortonington - I also assume standard VAWP will fail, for the same reason? Commented Oct 19, 2019 at 17:42
  • 1
    I believe so. I honestly have not checked on that, but as it runs the AMPscript again pulling from the sendable DE (which now does not have all the info) I believe it would either fail or display incorrectly for VAWP Commented Oct 19, 2019 at 17:46
  • 1
    @Gortonington will it let you publish the TS def if you use a string that’s not a profile attribute and not included in the TS DE?
    – zuzannamj
    Commented Oct 19, 2019 at 18:26
  • What does VAWP stand for? And if I'm understanding correctly, does this mean you can actually include placeholders indicated by %% in an email without necessarily defining them first in a data extension?
    – havenwang
    Commented Oct 20, 2019 at 1:35

You must log in to answer this question.

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