Adding targetData logic in an email | Community
Skip to main content
New Participant
May 12, 2022 9:53 PM UTC
Solved

Adding targetData logic in an email

Hi I'm very new to ACS, and was hoping someone can help me out.  I built an email and I'm trying to access targetData in the email for the make and model of a car.  I put the code below in the email (I tried "context.targetData" and "context.profile.targetData") and I just get back when I preview "'targetData' element unknown (see definition of 'Enrichment (temp:enrichment1-src)' schema)."  How do I fix this please?

 

<% var aVehicle = 'vehicle';
var aField1 = targetData.Make;
var aField2 = targetData.Model;
if( aField1 != '' || aField2 != '') { aVehicle = aField1 + ' ' + aField2; } document.write(aVehicle); %>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
bisswangAccepted solution
Employee
May 18, 2022 7:14 AM UTC

indeed you can't configure target data on test profiles

 

To test it completly, you need to use profile substitution feature:

https://experienceleague.adobe.com/docs/campaign-standard-learn/tutorials/communication-channels/email/profile-substitution.html?lang=en

2 replies

deuceAuthor
New Participant
May 13, 2022 3:58 PM UTC

I wasn't using the entire variable being pulled in from targetData.  It should have been:

 

context.targetData.cusWorkOrderLink1.Make;
 
Now I'm just having trouble testing with the test profiles since none of them have the data.
Translate
bisswangAccepted solution
Employee
May 18, 2022 7:14 AM UTC

indeed you can't configure target data on test profiles

 

To test it completly, you need to use profile substitution feature:

https://experienceleague.adobe.com/docs/campaign-standard-learn/tutorials/communication-channels/email/profile-substitution.html?lang=en

Translate