I’m trying to send a triggered send as is explained here: https://code.exacttarget.com/apis-sdks/fuel-sdks/triggered-sends/triggered-send-send.html#phpsend
I’m trying to display content from the web service in the email via AMPscript as is explained here: 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/
It’s not working though. How do I access the attribute values from the triggered send web service in the actual email within the AMPscript? Here is my web service call:
require('ET_Client.php'); $myclient = new ET_Client(); $triggeredsend = new ET_TriggeredSend(); $triggeredsend->authStub = $myclient; $triggeredsend->props = array('CustomerKey' => $customerkey); $triggeredsend->subscribers = array(array( 'EmailAddress' => $email, 'SubscriberKey' => $email, 'Attributes' => array('Name' => 'maxTransport', 'Value' => $maxTransport) )); $results = $triggeredsend->send();
And here is how I’m trying to display the variable in my email:
Max Transport = %%maxTransport%%
But the variable is not showing up, and I get a validation error for my email that says:
Errors found in the email HTML Body. Category : Substitution String
Personalization error:%%maxtransport%% To fix the problem, please try
the following: Make sure that there is not a space or typo within the
personalization string in your email. For example, check and correct
any spaces between percent signs (%%)
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Welcome to SFSE!
Do you have a maxTransport
column in the target Data Extension configured in your Triggered Send Definition? If not, you’ll need one.
It’s a good practice to wrap personalization strings with the AttributeValue() function in your email. Make sure to include the double-quotes around the attribute name. For example:
%%[ var @maxTransport set @maxTransport = AttributeValue("maxTransport") ]%% <br>maxTransport: %%=v(@maxTransport)=%%
If you use the AttributeValue()
function, you can check if it’s undefined or empty using the empty()
function, e.g:
%%[ if not empty (@maxTransport) then outputLine(concat("maxTransport: ",@maxTransport)) else outputLine(concat("maxTransport is empty")) endif ]%%
Method 2
For others, I thought I’d post my answer to a similar question on how to do this specifically with ExactTarget and PHP:
https://salesforce.stackexchange.com/a/163609/71196
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0