Trying to create an email script/token with conditional #if/#else formatting

Alan_Harris1
Level 1

Trying to create an email script/token with conditional #if/#else formatting

Hi all, I'm trying to create an email script for a campaign that uses conditional #if / #else / #end formatting.

I created a new script called {{my.Industry}} that uses a custom SFDC string field called "Company Tag" that contains descriptions like "B2B, Information Technology", B2C, Retail", etc.

I'm using the if/else statements to declare that if this field ${lead.Company_Tags__c} has a string containing "B2B", then display a particular line of text. If not, then display this alternate line of text.

The email script looks like this:

#if (${lead.Company_Tags__c}.toString().contains("B2B"))

from companies like A, B, and C

#else

from companies like D, E, and F

#end

I double checked that the object "Company Tag" had a checked box, but when I save the email script token and add it my HTML as {{my.Industry}} and preview, it doesn't display the values but still shows the token.

When I try to approve the campaign, it gives me the following error:

Screen Shot 2018-06-26 at 9.49.49 AM.png

Any help or insight would be greatly appreciated!