次の Visualforce ページがあり、関連リストまたは pageblocktables を case.recortype または case.recordtype.id フィールドでフィルタリングする必要があります。これを行う方法を見つけるために誰かが私を導くことができますか? ありがとう
<apex:page standardController="Account" >
<apex:pageblock title="Cases" >
<apex:pageblockSection >
<apex:relatedList title="Support Cases" list="Cases"/>
</apex:pageblockSection>
<apex:pageblockSection >
<apex:relatedList title="Training Cases" list="Cases"/>
</apex:pageblockSection>
</apex:pageblock>
<apex:pageBlock title="Support Cases" >
<apex:pageBlockTable value="{!Account.Cases}" var="c">
<apex:column headervalue="Case"><apex:outputLink value="/{!c.id}">{!c.CaseNumber}</apex:outputLink></apex:column>
<apex:column value="{!c.Contact.Name}"/>
<apex:column value="{!c.Subject}"/>
<apex:column value="{!c.Priority}"/>
<apex:column value="{!c.CreatedDate}"/>
<apex:column value="{!c.status}"/>
<apex:column value="{!c.createdbyId}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Training Cases" >
<apex:pageBlockTable value="{!Account.Cases}" var="c">
<apex:column headervalue="Case"><apex:outputLink value="/{!c.id}">{!c.CaseNumber}</apex:outputLink></apex:column>
<apex:column value="{!c.Contact.Name}"/>
<apex:column value="{!c.Subject}"/>
<apex:column value="{!c.Priority}"/>
<apex:column value="{!c.CreatedDate}"/>
<apex:column value="{!c.status}"/>
<apex:column value="{!c.createdbyId}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
更新:これは私が実際にやったことです:
ページ:
<apex:page standardController="account" extensions="SupportCasefilter,TrainingCasefilter">
<apex:form >
<apex:pageBlock title="Support Cases">
<apex:pageBlockTable value="{!SupportCases}" var="s">
<apex:column headervalue="Case"><apex:outputLink value="/{!s.id}">{!s.CaseNumber}</apex:outputLink></apex:column>
<apex:column value="{!s.Contact.Name}"/>
<apex:column value="{!s.Subject}"/>
<apex:column value="{!s.Priority}"/>
<apex:column value="{!s.CreatedDate}"/>
<apex:column value="{!s.status}"/>
<apex:column value="{!s.createdbyId}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Training Cases">
<apex:pageBlockTable value="{!TrainingCases}" var="t">
<apex:column headervalue="Case"><apex:outputLink value="/{!t.id}">{!t.CaseNumber}</apex:outputLink></apex:column>
<apex:column value="{!t.Contact.Name}"/>
<apex:column value="{!t.Subject}"/>
<apex:column value="{!t.Priority}"/>
<apex:column value="{!t.CreatedDate}"/>
<apex:column value="{!t.status}"/>
<apex:column value="{!t.createdbyId}"/>
<apex:column value="{!t.recordtype.id}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
コントローラー1:
public with sharing class SupportCasefilter {
public id accRecId;
public SupportCasefilter(ApexPages.StandardController controller) {
accRecId = [select id from account where id = :ApexPages.currentPage().getParameters().get('id')].id;
}
List<case> supportCases;
public List<case> getSupportCases() {
if(accRecId != null) {
supportCases= [SELECT Id, Contact.name, recordtype.id, casenumber, subject, priority, createddate, status, createdbyid
FROM Case
WHERE Record_Type__c='Support' AND account.id=:accRecId];
}
return supportCases;
}
}
コントローラー2:
public with sharing class TrainingCasefilter {
public id accRecId;
public TrainingCasefilter(ApexPages.StandardController controller) {
accRecId = [select id from account where id = :ApexPages.currentPage().getParameters().get('id')].id;
}
List<case> trainingCases;
public List<case> getTrainingCases() {
if(accRecId != null) {
trainingCases= [SELECT Id, Contact.name, recordtype.id, casenumber, subject, priority, createddate, status, createdbyid
FROM Case
WHERE Record_Type__c='Training' AND account.id=:accRecId];
}
return trainingCases;
}
}