SOLVED

Conditional display in script token

Go to solution
Emma_Wu
Level 2

Conditional display in script token

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Conditional display in script token

In Velocity, everything that's outside of a #directive is automatically output.

 

So you're overcomplicating things (and there's also a syntax error, but we can resolve that by not having any special syntax at all).

 

All you need is:

#if( $lead.mktohiddenadminstring1.equals("21Q2-incentive-form") )
Thank you for submitting your brand for consideration for our Growth Spurt Campaign.
#end

If the condition doesn't match, there's no output.

 


Also, is there a way I can control the formatting of this sentence, such as font, size...

Certainly. You can output HTML tags and styles, Velocity just outputs whatever you tell it to:

#if( $lead.mktohiddenadminstring1.equals("21Q2-incentive-form") )
Thank you for submitting your brand for consideration for our <strong>Growth Spurt Campaign.</strong>.
#end

 

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Conditional display in script token

In Velocity, everything that's outside of a #directive is automatically output.

 

So you're overcomplicating things (and there's also a syntax error, but we can resolve that by not having any special syntax at all).

 

All you need is:

#if( $lead.mktohiddenadminstring1.equals("21Q2-incentive-form") )
Thank you for submitting your brand for consideration for our Growth Spurt Campaign.
#end

If the condition doesn't match, there's no output.

 


Also, is there a way I can control the formatting of this sentence, such as font, size...

Certainly. You can output HTML tags and styles, Velocity just outputs whatever you tell it to:

#if( $lead.mktohiddenadminstring1.equals("21Q2-incentive-form") )
Thank you for submitting your brand for consideration for our <strong>Growth Spurt Campaign.</strong>.
#end

 

Emma_Wu
Level 2

Re: Conditional display in script token

Thank you @SanfordWhiteman - I have used the code you sent, and I still hit an error: "Cannot get email content- A newline character is expected at the end of Email Script". Do you know what that is referring to?

SanfordWhiteman
Level 10 - Community Moderator

Re: Conditional display in script token

Means you need a line break after the #end directive.

Emma_Wu
Level 2

Re: Conditional display in script token

Ah, thank you! Much appreciated 😄 This community is so blessed to have you!