You need to sign in to do that
Don't have an account?
Amanda Malmstrom
apex:repeat in visualforce email template is working on one object but not another object
Hello,
I have logic in an email that works perfectly on one custom object, but when repurposing that logic into another custom object's email it does not work.
This is my snipit that does not work:
<apex:repeat var="cb" value="{!relatedTo.Advance__r.CoBrand__c}">
<apex:outputPanel rendered="cb == 'BrandA'">
The BrandA Company
</apex:outputPanel>
<apex:outputPanel rendered="cb != 'BrandA'">
The BrandB Company
</apex:outputPanel>
</apex:repeat>
I checked and {!relatedTo.Advance__r.CoBrand__c} does populate on its own within the email body, but the apex statement does not render any text. I had to go with the == and != approach because CoBrand__c can have many values but the only time the statement needs to be different is for BrandA.
Is there something wrong with the syntax?
I have logic in an email that works perfectly on one custom object, but when repurposing that logic into another custom object's email it does not work.
This is my snipit that does not work:
<apex:repeat var="cb" value="{!relatedTo.Advance__r.CoBrand__c}">
<apex:outputPanel rendered="cb == 'BrandA'">
The BrandA Company
</apex:outputPanel>
<apex:outputPanel rendered="cb != 'BrandA'">
The BrandB Company
</apex:outputPanel>
</apex:repeat>
I checked and {!relatedTo.Advance__r.CoBrand__c} does populate on its own within the email body, but the apex statement does not render any text. I had to go with the == and != approach because CoBrand__c can have many values but the only time the statement needs to be different is for BrandA.
Is there something wrong with the syntax?
Thanks,
Matt
Correct format:
<apex:repeat var="cb" value="{!relatedTo.Advance__r.CoBrand__c}">
<apex:outputText rendered="{! IF(cb == 'BrandA', true, false)}">
The BrandA Company
</apex:outputText>
<apex:outputText rendered="{! IF(cb != 'BrandA', true, false)}">
the BrandB Company
</apex:outputText>
</apex:repeat>