Validation Error with Velocity Scripts | Community
Skip to main content
New Participant
May 16, 2023
Solved

Validation Error with Velocity Scripts

  • May 16, 2023
  • 1 reply
  • 972 views

Hello,

 

I've started using velocity scripts in my emails however once I try to save the email I get an error validation message.
Has anyone had similar issues previously?

 

 


This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Darshil_Shah1

Please use #set and not #Set, and similarly use #end and not #End. The keywords in the velocity script are case-sensitive. Additionally, instead of using == use equals() as it's more robust.

 

#if($lead.currentPage.equals("www.example.com")) #set($content = "This is a test") ${content} #end

 

Make sure you've check-marked the custom field "Current Page" that you're using in your script, and additionally, you also want to ensure that the field name that you're using in the script matches with what you see when you pull the variable from the field selector to the code editor (snapshot below).

 

1 reply

Darshil_Shah1
Darshil_Shah1Accepted solution
Community Manager
May 16, 2023

Please use #set and not #Set, and similarly use #end and not #End. The keywords in the velocity script are case-sensitive. Additionally, instead of using == use equals() as it's more robust.

 

#if($lead.currentPage.equals("www.example.com")) #set($content = "This is a test") ${content} #end

 

Make sure you've check-marked the custom field "Current Page" that you're using in your script, and additionally, you also want to ensure that the field name that you're using in the script matches with what you see when you pull the variable from the field selector to the code editor (snapshot below).