I am display table rows in my email template...


However it is possible for opportunity__r to be null. I only want to add a row if the my custom object is pointing to a valid opportunity.

Any tips?


Wrap the block in an outputPanel and use rendered attribute and have a logic to render only if the value is not equal.Please note this you can have only if your email Template is a Visualforce template .

<apex:outputPanel rendered={!IF(relatedTo.opportunity__r.stageName!=null)}
  • 1
    this almost I workds. I had to do: <apex:outputPanel rendered="{!IF(relatedTo.opportunity__r !=null, true, false)}"> I was interested in the Opportunity reference was null or set.
    – dublintech
    Dec 31 '12 at 15:13
  • I think rather than writing rendered={!IF(relatedTo.opportunity__r.stageName!=null)} you should use rendered={!relatedTo.opportunity__r.stageName !=null}. there is not need to use if statement Dec 31 '12 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.