문제

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?

도움이 되었습니까?

해결책 2

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

다른 팁

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top