Hi
As a very new person to marketo I need a some help with this. I am trying to create a small email script so that the value true is rpelaced with yes in the email and the value blank is replaced with No. A token is created on the program and I select email token. Then I insert the following
# if (${lead.Customer_expect_to_be_contacted_by_Sales__c}== "true" )
Yes
# else
No
# END
Then I insert the token into my email, but when I test it it dosent insert the value Yes/No but the code. It is like it treats the code as plain text or something. The result in the meail lokks like this # if (1== "true" ) Yes # else No # END.
I found this example on the forum
#if(${lead.fieldname} == "fieldvalue1")
Email text here
#elseif (${lead.fieldname} == "fieldvalue2")
Email text here
#else
Email text here
#end
Is there somebody who can tell me what I am doing wrong.
Solved! Go to Solution.
Sorry, Tom
Please try this code
#set( $foo = ${lead.Customer_expect_to_be_contacted_by_Sales__c} )
#if ($foo == 1 )
Yes
#else
No
#end
Hi Tom,
Not sure, but what type of token have you selected? I have a similar token and for me it works but the token type has to be "Email Script". If you select a different type this might be causing this behavior.
Hope that helps.
First, delete those spaces after the #. It should be #if not # if.
Second, double check that you have that field checked in the list on the right side.
If that doesn't fix it, screenshots would help.
Hi Tom
This code works file.
#set( $foo = ${lead.Marketing_Suspended})
FOO = $foo
#if( $foo == 1 )
Marketing_Suspend1 is TRUE
#else
Marketing_Suspend1 is FALSE
#end
So, try below.
#if (${lead.Customer_expect_to_be_contacted_by_Sales__c} == 1 )
Yes
#else
No
#END
HI All
Thanks for all the good input. I have changed the code but now I am running into this errors. Below is a picture of the current code and the error message I receive when trying to email a sample
Best regards
Tom
Change #END to be #end (note the syntax highlighting which is showing you it is not correct)
Thanks for all the help - It is working now