Using Velocity Script to Display an Image
Hello Community 👋🏻
I use Velocity Scripts in our conference emails to pull in data points from an integrated system so that I can get creative with the content displayed. I usually only work with text content scripts and today I’m trying to create one for an image but I cannot get it to work.
Intent: I want to show this image if someone has NOT filled out a quiz that’s part of our registration process. i.e. the Data point is Oktane Lab Profile (oktaneLabProfile) and IS EMPTY.
Script: This is what Gemini gave me after I asked for help fixing the script.
## Determines whether Quiz image is shown or not
#if( !$lead.oktaneLabProfile || $lead.oktaneLabProfile == "" )
<img src="https://pages.okta.com/rs/855-QAH-699/images/Hero-Oktane-Identity-1072x400.png?version=0" alt="Find your Oktane identity" />
#end
Use: I inserted the token into an image module that I’m using for this section (so that the formatting/styling is used vs just adding a simple image into a text module for example).
Preview: This is what I see in the Marketo Preview screen - as the script is looking for the field to be EMPTY, I expect to see the image here.

Additional checks:
- I have checked the box for this field in the VS editor
- I used a test email that I know has that field empty and I get the same visual result
- I have two text VS modules underneath this one that are using the same field, and they work/show as expected in the Preview (default and with my test email)
As usual, I feel like someone’s going to point something out that’s going to make me 🤦🏻 and I’m OK with that! Can anyone help a VS noob? Thanks in advance 🙏🏻
