Skip to main content
edited body
Source Link
SFDC FanBoy
  • 4.1k
  • 8
  • 44
  • 88

I have a visualforce email template. I use a visualforce component in it and an apex controller to display some data in the email. Everything is fine till here. Now, I want to render some part of the email content based on User.Interests__c (a custom field in my user object).

So, I used rendered condition in an outputPanel and checking the Interests condition. Now, if the rendered is TRUE, email is sent perfectly (with the image rendered correctly). When the rendered condition is FALSE, email is NOT SENT.

Ideally, when the rendered condition is FALSE, email should be sent without the image in the outputpanel. What is wrong with this?

Please let me know. Here's the code:

VF template

    <tr>    
      <apex:outputPanel rendered="{!checkUserInterest}">       
          <td align="left" <imgalign="left"><img src="http://resources.dood.com/logo.png"/></td> 
      </apex:outputPanel>      
    </tr>
  
</table>

//Apex class code

public boolean isIA;
public boolean getcheckUserInterest() {
    if(User.User_Interests__c != null) {
        isIA = user.User_Interests__c.contains('Host')?true:false;
    }else {
        isIA = false;
    }
    return isIA;
}

PS: I had to use a controller and component for all this because Interests__c is a multi select picklist field. I cannot use CONTAINS(User.Interests__c) etc directly in output panel rendered condition. Thats limitation from Salesforce.

I have a visualforce email template. I use a visualforce component in it and an apex controller to display some data in the email. Everything is fine till here. Now, I want to render some part of the email content based on User.Interests__c (a custom field in my user object).

So, I used rendered condition in an outputPanel and checking the Interests condition. Now, if the rendered is TRUE, email is sent perfectly (with the image rendered correctly). When the rendered condition is FALSE, email is NOT SENT.

Ideally, when the rendered condition is FALSE, email should be sent without the image in the outputpanel. What is wrong with this?

Please let me know. Here's the code:

VF template

    <tr>    
      <apex:outputPanel rendered="{!checkUserInterest}">       
          <td align="left" <img src="http://resources.dood.com/logo.png"/></td> 
      </apex:outputPanel>      
    </tr>
  
</table>

//Apex class code

public boolean isIA;
public boolean getcheckUserInterest() {
    if(User.User_Interests__c != null) {
        isIA = user.User_Interests__c.contains('Host')?true:false;
    }else {
        isIA = false;
    }
    return isIA;
}

PS: I had to use a controller and component for all this because Interests__c is a multi select picklist field. I cannot use CONTAINS(User.Interests__c) etc directly in output panel rendered condition. Thats limitation from Salesforce.

I have a visualforce email template. I use a visualforce component in it and an apex controller to display some data in the email. Everything is fine till here. Now, I want to render some part of the email content based on User.Interests__c (a custom field in my user object).

So, I used rendered condition in an outputPanel and checking the Interests condition. Now, if the rendered is TRUE, email is sent perfectly (with the image rendered correctly). When the rendered condition is FALSE, email is NOT SENT.

Ideally, when the rendered condition is FALSE, email should be sent without the image in the outputpanel. What is wrong with this?

Please let me know. Here's the code:

VF template

    <tr>    
      <apex:outputPanel rendered="{!checkUserInterest}">       
          <td align="left"><img src="http://resources.dood.com/logo.png"/></td> 
      </apex:outputPanel>      
    </tr>
  
</table>

//Apex class code

public boolean isIA;
public boolean getcheckUserInterest() {
    if(User.User_Interests__c != null) {
        isIA = user.User_Interests__c.contains('Host')?true:false;
    }else {
        isIA = false;
    }
    return isIA;
}

PS: I had to use a controller and component for all this because Interests__c is a multi select picklist field. I cannot use CONTAINS(User.Interests__c) etc directly in output panel rendered condition. Thats limitation from Salesforce.

Source Link
SFDC FanBoy
  • 4.1k
  • 8
  • 44
  • 88

Visualforce Email Template rendering false email not sent

I have a visualforce email template. I use a visualforce component in it and an apex controller to display some data in the email. Everything is fine till here. Now, I want to render some part of the email content based on User.Interests__c (a custom field in my user object).

So, I used rendered condition in an outputPanel and checking the Interests condition. Now, if the rendered is TRUE, email is sent perfectly (with the image rendered correctly). When the rendered condition is FALSE, email is NOT SENT.

Ideally, when the rendered condition is FALSE, email should be sent without the image in the outputpanel. What is wrong with this?

Please let me know. Here's the code:

VF template

    <tr>    
      <apex:outputPanel rendered="{!checkUserInterest}">       
          <td align="left" <img src="http://resources.dood.com/logo.png"/></td> 
      </apex:outputPanel>      
    </tr>
  
</table>

//Apex class code

public boolean isIA;
public boolean getcheckUserInterest() {
    if(User.User_Interests__c != null) {
        isIA = user.User_Interests__c.contains('Host')?true:false;
    }else {
        isIA = false;
    }
    return isIA;
}

PS: I had to use a controller and component for all this because Interests__c is a multi select picklist field. I cannot use CONTAINS(User.Interests__c) etc directly in output panel rendered condition. Thats limitation from Salesforce.