SOLVED

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

Go to solution
Benjinc
Level 2

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

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

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

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

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

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

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

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