Since few days, some of my deliveries don't want to be send out and mention me that the targetData is not defined.
Here is how the error looks like :
This was not happening before (the workflow was on a scheduler without any modification in the template and one day, this happens with this failure) and I still have some deliveries that works with the targetData in other templates.
But for an obscure reason, this issue happens for all the targetData I use in that template. I try to delete a piece of code in the HTML with a use of the targetData but it fails again because of an other targetData.
Example of the targetData I use : <%= targetData.member.point_Bal_Val %> and this one is working in another template I use.
Do you already encounter this problem and if yes, how I can resolve that ?
This is a common bug and the error message is actually wrong. When you have a JSSP tag in your delivery, something like <%= targetData.attributeName %>. If the attribute name is misspelled or wrong, the Adobe is unable to load the required column and targetData become undefined.
Said that, since your deliveries have been working before, I guess there are some data issues. In your case, when JSSP tag looks like <%= targetData.member.point_Bal_Val %> that probably means that you have some "member" table linked to a temporary table. If the table no longer exists or someone has renamed the attributes in it, you will see this error.
You can actually see what is loaded by your request. Click on "To" in Delivery Target Population, switch on Seed Address, add a new recipient and populate targetData as you think it should be.
Now, click on Preview, load seed recipient, and click on Data Loaded
You will get an XML with all loaded fields. Just check what they all have loaded correctly.
Have you seen it? Long story short, the targetData represents an XML that you are throwing on a delivery template to produce actual delivery and it maps to a temporary table schema. Any table column will become an attribute with the same name and any linked table will create a nested element with tag name equal to link name and attribute names, equal to linked table columns.
The delivery template will load these elements and attributes only if they are mention directly in JSSP tag. For example, the following expression will load @providerName column of a linked provider table.
<% var providerName = targetData.provider.providerName %>
But the following expression will only load provider @_cs and @providerName will be undefined:
var provider = targetData.provider
var providerName = provider.providerName
as for <%= recipient.firstName %>, you do not have to do anything, because the recipient is default Adobe table, and recipient record is always loaded if a recipient is targeted in the delivery.