SOLVED

Validation Error with Velocity Scripts

Go to solution
CAROL_UK15
Level 1

Validation Error with Velocity Scripts

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?

CAROL_UK15_0-1684227468396.png

CAROL_UK15_1-1684227560055.png

 

 


image.png

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Validation Error with Velocity Scripts

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).

Darshil_Shah1_0-1684228434762.png

 

View solution in original post

1 REPLY 1
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Validation Error with Velocity Scripts

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).

Darshil_Shah1_0-1684228434762.png