5 Replies Latest reply on Oct 30, 2017 7:25 AM by Phillip Wild

    Email script not evaluating variable in live send, but does in preview

    Phillip Wild

      Hi there

       

      I'm trying to dynamically feed a variable into a URL but I'm having trouble. It works just fine in preview mode (which I know isn't the same as a live test) but when I send myself a sample email, it breaks - the URL variable outputs as $MatchingToursDossiers[0] instead of the actual value I need.

       

      Here's the relevant code. Every other bit outputs as expected.

       

       

      ##set the matching tours arrays to be blank (this is our output)

      #set ($MatchingTours = [])

      #set ($MatchingToursDossiers = [])

       

       

      ##for each dossier that matches one in the Promo Map object, add it to the Matching Tours array.

       

      #foreach ($wish in $DossierArray)

      #if ($PromoMap[$wish])

      #set ($dummy = $MatchingTours.add($TourDossierMap[$wish]))

      #set ($dummy2 = $MatchingToursDossiers.add($wish))

      #end

      #end

       

      ##if no matching tours, print nothing. If one or more matching tours, print the relevant lines. And here's where it breaks down...$MatchingTours[0] outputs the text name just fine, but the $MatchingToursDossiers array doesn't resolve in the URL.

       

      #if ($MatchingTours.size() == 0 )

      #elseif ($MatchingTours.size() == 1 )

      <tr>

      <td align="center" valign="top" bgcolor="#ffffff" class="bodyText" style="padding-top:0;padding-bottom:30px;padding-right:15px;padding-left:15px;border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;color:#000000;font-size: 16px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: left; line-height:24px; mso-line-height-rule:exactly;vertical-align:top;text-decoration:none; font-weight:400;"> This might look familiar: <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[0]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[0]</a> from your Wish List is part of this sale! What are you waiting for?

      </td>

      </tr>

       

      #elseif ($MatchingTours.size() == 2 )

      <tr>

      <td align="center" valign="top" bgcolor="#ffffff" class="bodyText" style="padding-top:0;padding-bottom:30px;padding-right:15px;padding-left:15px;border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;color:#000000;font-size: 16px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: left; line-height:24px; mso-line-height-rule:exactly;vertical-align:top;text-decoration:none; font-weight:400;"> These might look familiar: <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[0]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[0]</a> and <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[1]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[1]</a> from your Wish List are part of this sale! What are you waiting for?

      </td>

      </tr>

       

      #elseif ($MatchingTours.size() == 3)

      <tr>

      <td align="center" valign="top" bgcolor="#ffffff" class="bodyText" style="padding-top:0;padding-bottom:30px;padding-right:15px;padding-left:15px;border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;color:#000000;font-size: 16px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: left; line-height:24px; mso-line-height-rule:exactly;vertical-align:top;text-decoration:none; font-weight:400;"> These might look familiar: <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[0]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[0]</a>, <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[1]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[1]</a>, and <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[2]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[2]</a>

      from your Wish List are part of this sale! What are you waiting for?

      </td>

      </tr>

      #else

      <tr>

      <td align="center" valign="top" bgcolor="#ffffff" class="bodyText" style="padding-top:0;padding-bottom:30px;padding-right:15px;padding-left:15px;border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;color:#000000;font-size: 16px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: left; line-height:24px; mso-line-height-rule:exactly;vertical-align:top;text-decoration:none; font-weight:400;"> These might look familiar: <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[0]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[0]</a>, <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[1]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[1]</a>, <a href="https://www.gadventures.com/trips/$MatchingToursDossiers[2]/?utm_source=Consumer_Promo&utm_medium=email&utm_campaign=Stop_Book_Go_Start" style="text-decoration:underline; color:#47268d; font-size:16px; font-weight:bold;">$MatchingTours[2]</a>, and more

      from your Wish List are part of this sale! What are you waiting for?

      </td>

      </tr>

      #end

       

       

      #end

       

      Any ideas as to why this is breaking in this fashion? I've tried using $MatchingToursDossiers.get(0) and $MatchingToursDossiers(0) with no result.