Email script token not populating in mobile

Anonymous
Not applicable

Email script token not populating in mobile

Hi!

I'm fairly new to Velocity, and I'm currently testing out a script token that allows us to swap out the headshot in an email depending on the Lead/Sales Owner. It works great in the desktop inbox, but when I test it on mobile or view it online, the headshot doesn't populate. Does anyone know what could be causing this, and if there's a solution? Thanks!

##check if the lead owner first name is Brita

#if( $lead.Lead_Owner_First_Name == "Brita" )

  ##if the lead owner first name is Brita, use her headshot'

  #set($image = "pages.linkup.com/rs/458-RJT-465/images/BritaHeadshotInCircle.png")

##check if the lead owner first name is Derek

#elseif( $lead.Lead_Owner_First_Name == "Derek" )

  ##if the lead owner first name is Derek, use his headshot'

  #set($image = "pages.linkup.com/rs/458-RJT-465/images/DerekHeadshotInCircle2016_60px.png")

##check if the lead owner first name is Molly

#elseif( $lead.Lead_Owner_First_Name == "Molly" )

  ##if the lead owner first name is Molly, use her headshot'

  #set($image = "pages.linkup.com/rs/458-RJT-465/images/MollyHeadshotInCircle2016.jpg")

##check if the lead owner first name is Steven

#elseif( $lead.Lead_Owner_First_Name == "Steven" )

  ##if the lead owner first name is Steven, use his headshot'

  #set($image = "pages.linkup.com/rs/458-RJT-465/images/StevenHeadshotInCircle.jpg")

##check if the lead owner first name is Vince

#elseif( $lead.Lead_Owner_First_Name == "Vince" )

  ##if the lead owner first name is Vince, use his headshot'

  #set($image = "pages.linkup.com/rs/458-RJT-465/images/VinceHeadshotInCircle.jpg")

##check if the lead owner first name is Marc

#elseif( $lead.Lead_Owner_First_Name == "Marc" )

  ##if the lead owner first name is Marc, use his headshot'

  #set($image = "pages.linkup.com/rs/458-RJT-465/images/MarcHeadshotInCircle.jpg")

##check if the lead owner first name is Brad

#elseif( $lead.Lead_Owner_First_Name == "Brad" )

  ##if the lead owner first name is Brad, use his headshot'

  #set($image = "pages.linkup.com/rs/458-RJT-465/images/BradHeadshotInCircle2016.jpg")

#else

  ##otherwise, use the headshot of Tom

  #set($image = "pages.linkup.com/rs/458-RJT-465/images/TomHeadshotInCircle2016_80x80 %281%29.jpg")

#end

<img src="${image}"></img>

2 REPLIES 2
Level 10 - Community Moderator

Re: Email script token not populating in mobile

OK, first, Velocity has no awareness of desktop vs. mobile. It will always produce the same output. So it's clear that there's something in the surrounding markup which is not mobile-compatible.

Second, <img> tags are self-closing only in HTML. They must not have a closing </img> tag.

Third, please don't use the if-elseif structure. It makes my head hurt! Use a map, it's shorter and easier to maintain:

  "Molly" : "/mollysheadshot.jpg",

  "Marc" : "/marcsheadshot123.jpg"

}

Anonymous
Not applicable

Re: Email script token not populating in mobile

Very helpful - thank you!

I ended up replacing this

<img src="${image}"></img>

with this

<img src="http://pages.linkup.com/rs/458-RJT-465/images/${image}">

and mapping, as you suggested. Adding in the "http://" to the image source URL fixed the mobile and "view online" issues, so I'm thinking it must have been a local file issue.

Thanks for your help!