Some things to note: AdPotentialCancellation is the name of the SFDC Custom Object being referenced. 'Name' is the field I am trying to get to populate in the email with the above script. I have other fields that I also need to populate in the email.

These are the other fields I would like to populate in separate email scripts in the email: 'Declined_Amount__c' & 'Decline_Date__c'. I have done some work on formatting the amount field to be currency and the date to be a date -- it works only if I used the standard code that grabs the oldest field.

An issue I keep seeingis that the email renders the $lastItem.Name, ${amount} or ${declineDate_formatted} instead of any data. I used the below code here to confirm that the data exists for the test lead on the object, and made sure to check all the fields I need in the right column to see the full list. I can see data is there for all fields.

I tested it as a 'send alert' send to my email for the specific lead record that has data on that object as well as a test sample send spoofing that lead in addition to just previewing it as a person in the preview panel. The results are the same. The list won't populate. it just displays the code.

Here is what that token looks like when I have it in script and what is checked on the right.

However, when I do this code with the same boxes checked in the script token - it populates in the email in all ways to listed above for testing.

I tested it as a 'send alert' send to my email for the specific lead record that has data on that object as well as a test sample send spoofing that lead in addition to just previewing it as a person in the preview panel.

The only ways to reliably test Velocity are:

Preview by List (with a Static List of people with values populated)

Send actual email (not sample)

In production, Send Alert will work, but I never test that way.

Sample must never be used unless all of your content is generated within Velocity, i.e. nothing from the Lead or from COs at all.

This data is coming through a salesforce custom object, does that impact any of the ways we could test this?

No, it doesn't, but your results still don't make sense. You seem to be saying that:

$display.list($AdPotentialCancellation_cList,"\u000a")

fails while

$display.list($AdPotentialCancellation_cList,"<br>")

works.

But I think you're testing across different actual tokens so you're lacking a direct comparison.

What happens if you create a new token and use my exact code above for generating the object list in VTL? Don't check off the in object in the tree at first. Test with the mock list. Then remove the mock list and check off the object + fields in the tree and test again.

But that is just it, I don't think it is empty. When I check that lead in the database, there is data for this object in their lead details in the activity log. As well, the other code I was using to determine what data was on the object works.

I'm not sure I am following you. How are the two script checks working differently? Why would it work in one list display, but not the other? As far as I can tell, I am not doing anything different in terms of set-up, but one populates with an output and one is blank.