Output URL from Field with #foreach
Hello all, not sure if I am crazy or doing something wrong - but running into issues when using a #foreach script with the end result being a URL. Here's my basic test case:
##Standard Velocity Date/Time Fields
#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("America/Chicago") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )
#set( $ISO8601DateTime = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $ISO8601DateTimeWithSpace = "yyyy-MM-dd HH:mm:ss" )
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" )
#set( $ISO8601DateTimeWithMillisTZ = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" )
##iterate Customer Loan object records and set Auto Loan Survey Link Last Updated to usable value for script
#foreach( $item in $customerLoansList )
#set( $autoSurveyURL = $convert.parseDate(
$item.surveyLinkLastUpdatedNewAutoLoan,
$ISO8601DateOnly,
$defaultLocale,
$defaultTimeZone
) )
##Sets difference from Last Updated Auto Survey Date and Current Date for between -2 and 0 Days
#set( $pastDiff = -2 )
#set( $currentDiff = 0 )
#set( $diffDays = $date.difference($calNow,$autoSurveyURL).getDays().intValue() )
#set( $acceptableDiffs = [$pastDiff..$currentDiff] )
#if( $acceptableDiffs.contains($diffDays) && ( !$item.surveyLinkNewAutoLoan.isEmpty() ) && (!$item.surveyLinkLastUpdatedNewAutoLoan.isEmpty()) )
<tr id="buttonOnly" mktoname="Button" class="mktoModule">
<td style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0px !important; padding: 0px;">
<!--[if mso | IE]>
<tr>
<td class="" width="600px">
<table
align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600">
<tr>
<td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
<![endif]-->
<div style="margin:0px auto;max-width:600px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
<tbody>
<tr>
<td style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0px !important; direction: ltr; font-size: 0px; padding: 5px 20px; text-align: center;">
<!--[if mso | IE]>
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="" style="vertical-align: middle;width:560px;">
<![endif]-->
<div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:center;direction:ltr;display:inline-block;vertical-align: middle;width:100%;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; vertical-align: middle;" width="100%">
<tr>
<td align="center" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0px !important; font-size: 0px; padding: 10px 25px; word-break: break-word;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-collapse: separate; line-height: 100%;">
<tr>
<td align="center" bgcolor="#0071CE" role="presentation" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-spacing: 0px !important; padding: 0px; border: 2px solid #0071CE; border-radius: 6px; cursor: auto; mso-padding-alt: 17px 30px; background: #0071CE;" valign="middle">
<a href="https://$item.surveyLinkNewAutoLoan" style="display: inline-block; background: #0071CE; color: #FFFFFF; font-family: 'Poppins', Arial; font-size: 16px; font-weight: bold; line-height: 120%; margin: 0; text-decoration: none; text-transform: none; padding: 12px 20px; mso-padding-alt: 0px; border-radius: 6px;" target="_blank">Take Survey</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!--[if mso | IE]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]>
</td>
</tr>
</table>
</td>
</tr>
<![endif]-->
</td> </tr>
#break
#else
#end
#end
When I use preview mode it is pulling the correct URL into the button widget. So it seems like the script itself is somewhat correct. I also followed the recommendations I found to house the entire <a> tag within the script (thus the large button widget formatting).
The issue is on a live test it seems to not resolve through the tracking redirect.
Is there something with Marketo that breaks pulling in a URL from a field? I've done it successfully in other cases but not with the #foreach loop.