Frage

I'm trying to add a if-Statement to my E-Mailtemplate (Type: HTML). I used the following code:

{!if(Lead.LastName="", "1", "2")}

My Output is just nothing :/

Does anyone know how to do it right?

War es hilfreich?

Lösung 2

Got it work now. I just changed the Formating a bit, and now it works. Very strange...

Andere Tipps

I believe the more complex logic like conditionally rendering data is not available in straightforward emails. IF, BLANKVALUE etc functions don't work, instead there's something similar to Dear {!Lead.LastName, 'Sir or Madam'} that's supposed to be fallback scenario if the field was empty.

If you're not too afraid - make a visualforce email template instead?

<messaging:emailTemplate subject="Hello StackOverflow" recipientType="User" relatedToType="Lead">
    <messaging:HtmlEmailBody >
        <p>Related To: {!relatedTo.Name}, {!relatedTo.LeadSource}</p>
        <p>Recipient: {!recipient.Username}</p>

        <p>{!IF(ISBLANK(relatedTo.LeadSource), '1', '2')}</p>
    </messaging:HtmlEmailBody>
</messaging:emailTemplate>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top