Velocity Scripting - V simple 'contains' on an email domain will not work | Community
Skip to main content
New Participant
June 7, 2024
Solved

Velocity Scripting - V simple 'contains' on an email domain will not work

  • June 7, 2024
  • 1 reply
  • 800 views

I have set up a script that I want to use to print content as and when people have a certain email domain as the below. 

It defaults to the 'else' even when the users email is  xxxx.yyyy@1234.com

What have I got wrong??

 

#if ($lead.email.contains("@1234.com"))

 

<p style="font-size:22px">The following message is for @xxxx.com only domains</p>

 

#else

 

#end

Best answer by SanfordWhiteman

To use a field in Velocity, check it off in the tree on the right hand side of Script Editor. This also lets you drag the the field to the canvas, which will show your error (a typo in the field name).

Finally, you should be using endsWith (https://docs.oracle.com/javase/6/docs/api/java/lang/String.html).

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
June 8, 2024

To use a field in Velocity, check it off in the tree on the right hand side of Script Editor. This also lets you drag the the field to the canvas, which will show your error (a typo in the field name).

Finally, you should be using endsWith (https://docs.oracle.com/javase/6/docs/api/java/lang/String.html).