function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anil DuttAnil Dutt 

If condition in Visualforce Email Template

Hi,

i want to add an IF conditon to do not include some data in Visualforce Email Template

    <apex:repeat var="cx" value="{!relatedTo.Airline_Conf_s__r}">     
          {!IF(!cx.Include_in_Confirmation__c == true}
{
          <tr>        
              <td  style="text-align:left;float:left;" width="195">
                   <apex:outputText value="{!cx.Airlines_Url__c}" escape="false" />
              </td>
             <td width="195" style="text-align:left;float:left;">{!cx.Conf__c}</td>
         </tr>
}
    </apex:repeat>

Is this posiible?

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
LakshmanLakshman

Hi Anil,

 

You could rewrite your code as below to make it work:

 

 

<apex:repeat var="cx" value="{!relatedTo.Airline_Conf_s__r}">     

<apex:outputPanel rendered="{!NOT(cx.Include_in_Confirmation__c)}"
          <tr>        
              <td  style="text-align:left;float:left;" width="195">
                   <apex:outputText value="{!cx.Airlines_Url__c}" escape="false" />
              </td>
             <td width="195" style="text-align:left;float:left;">{!cx.Conf__c}<

/td>
         </tr>
</apex:outputPanel>
    </apex:repeat>

 

Let me know if it works.

 

Regards,

Lakshman

All Answers

asish1989asish1989

Hi Anil

    please refer this Link..I think It will help you alot.....

 

     http://boards.developerforce.com/t5/Apex-Code-Development/How-to-use-condtion-statment-in-visualforce-template/m-p/435071#M79030

  

Did this post solve your problem...? if so, please mark it solved otherwiase let me know about your problem

 

 

Thanks

asish

 

Anil DuttAnil Dutt

Hi Asish,

 

I think its a bad practice, especially when the data we are trying to hide from users is a security breach and all they have to do is look at the source to see it.

 

so instead of Hiding the Div we should not add it at all

asish1989asish1989

 Hi Anil

    sometimes It is necessary to hide some div.

    Here I am giving an example to make you clear

    suppose a visualforce page is designed for all users which contains standard object Information ie Lead Product2 ,    Pricebook2 ...etc.Visualforce page is running successfully for all users.

 Suppose an user is restricted to access pricebook2 object.That means you set previlage for security reason.

 Now is it possible to run that page....?An error is always fired for a particular user.so how do you avoid that error..?

In that situation you can design different page for different user.is it so easy......?

It will be better If you make different div for different object and In particular div a condition which let you know whether   user  is accessible or not . div having true condition result is displayed and other's are hidden.

 this is the condition ......

rendered="{!$ObjectType.Lead.accessible}"

Now come to my link what I have given.In that link there are many condition ..you may choose one.If your requirement is not to hide then dont do it ,No one is forcing you to hide.Its purely based on requirement.

 

Thanks

asish

 

 

 

Anil DuttAnil Dutt

Hi Asish,

 

yes i don't want to hide div, just want to not include it at all

and if you check 'table-column" will not hide div in IE, please try

LakshmanLakshman

Hi Anil,

 

You could rewrite your code as below to make it work:

 

 

<apex:repeat var="cx" value="{!relatedTo.Airline_Conf_s__r}">     

<apex:outputPanel rendered="{!NOT(cx.Include_in_Confirmation__c)}"
          <tr>        
              <td  style="text-align:left;float:left;" width="195">
                   <apex:outputText value="{!cx.Airlines_Url__c}" escape="false" />
              </td>
             <td width="195" style="text-align:left;float:left;">{!cx.Conf__c}<

/td>
         </tr>
</apex:outputPanel>
    </apex:repeat>

 

Let me know if it works.

 

Regards,

Lakshman

This was selected as the best answer
Anil DuttAnil Dutt

Thanks Lakshman

 

it works like charm..........