You need to sign in to do that
Don't have an account?

How to filter related list in an email template approachbutwithnoluck
I need to filter a related list for the active inventory in a related list. Similar to this question:
This is simple in an XSLT implementation.
I found the following:
<apex:dataTable value="{!relatedTo.Opportunities}" var="o">
<apex:column value="{!o.Name}" rendered="{!o.IsClosed == false}"/>
<apex:column value="{!o.CloseDate}" rendered="{!o.IsClosed == false}"/>
</apex:dataTable>
This seams a lot easier than having to write a customer controller.
I have tried to apply the rendered="{!o.IsClosed == false} approach to the following code with no luck.
Any suggestions?
<apex:repeat var="cx" value="{!relatedTo.ri__Units__r}">
<tr>
<td WIDTH=100 >{!cx.Year__c}</td>
<td WIDTH=200>{!cx.Make__c}</td>
<td WIDTH=300>{!cx.Model__c}</td>
<td WIDTH=200>$<apex:outputText value="{0,number,00,000}"> <apex:param value="{!cx.ri__ListPrice__c}"/> </apex:outputText> </td>
<td WIDTH=200><img src={!cx.ri__Unit_Main_Image__c} height=100 width=150 alt={!cx.Model__c} /></td> </tr> </apex:repeat>
You should create a formula field on your object that returns a Boolean (true / false) text value or use a checkbox standard field like IsClosed or IsWon.
For example
Then the example you found becomes:
To make this work in HTML rather than APEX, you need to embed the conditional inside the brackets:
The only issue with using HTML vs. an apex:DataTable is that the render = fales parameter prevents a blank line in the table. Your HTML code will generate a line return every time you process the <tr> tag.
Unless I am not understanding what you are referencing, I believe your reference to ri__Units__r is wrong. It should be the Object.Related_Object_Plural_Name.
Hope that helps.
NeuNet Consultants