[SalesForce] Conditional rendering using IF in Visualforce Template

I have a VF template where I need to vary the closing part of the mail(after 'Best Regards') based on a particular Picklist field on the case object.

Eg if Custom_field__c ='ML' then the closing part of the email should be – ABC
if Custom_field__c ='SS' then the closing part of the email should be – CFG and a few similiar conditions. My code here does not seem to work

 <messaging:emailTemplate subject="{!relatedTo.Subject}, 

        {!relatedTo.CaseNumber} {!relatedTo.ThreadId__c}" 
        recipientType="Contact" relatedToType="Case">
        <messaging:htmlEmailBody >

      <html>      
   <body>
<STYLE type="text/css">   
td.content{font-size: 14px; font-face: Verdana; text-align: left}  
</style>

  <td class="content">       
 <br> Should you have any further enquiries, you may simply reply to this email.</br>      

   <apex:repeat var="cs" value="{!relatedTo}">
   <apex:outputpanel rendered="{If(ISPICKVAL(cs.Custom_field__c ,'Maersk Line')true,false)}">

      <br>Kind Regards,</br>
          Msl 

        </apex:outputpanel>
        </apex:repeat>             
      </td>
    </tr>   
  </table>
</font>
</body>
</html>
</messaging:htmlEmailBody>

Best Answer

As mentioned by Tushar, relatedTo is a single record, not a list. Merge fields always start with {! and end with }. You forgot the !. Also, you don't need an "IF" statement here:

rendered="{!ISPICKVAL(relatedTo.Custom_field__c ,'Maersk Line')}"
Related Topic