【发布时间】:2017-05-16 05:29:18
【问题描述】:
我有两个自定义对象,类别和案例,我将类别设置为父对象。类别中的列 Category_ID 由自定义对象 Case 引用。我在开发者控制台中执行了两个查询
SELECT Category_ID__c,id, Name FROM Category__c SELECT Category_ID__c,id, Name FROM Case__c 我发现Case中Category_ID的值就像'a0D'F000001MmjUae'和'a0D'F000001MmjUde',但在Category中它是'0'和'1'。
视觉页面
<apex:outputLabel value="Category" />
<apex:selectList value="{!categoryType}" size="1">
<apex:selectOptions value="{!items}"/>
</apex:selectList>
<apex:outputLabel value="Case" />
<apex:selectList value="{!caseId}" size="1">
<apex:selectOptions value="{!items2}"/>
</apex:selectList>
//From here is Controller
public String categoryType{set;get;}
public List<SelectOption> getItems(){
List<selectoption> mlst = new List<selectoption>();
for(VirtualCaseCategory__c m: [SELECT Category_ID__c, Name FROM VirtualCaseCategory__c]){
mlst.add(new selectoption(m.Id,m.Name));
}
return mlst;
}
public List<SelectOption> getItems2(){
List<selectoption> mlst = new List<selectoption>();
for(VirtualCaseCases__c m: [SELECT Category_ID__c, Name FROM VirtualCaseCases__c WHERE Category_ID__c =:categoryType]){
mlst.add(new selectoption(m.Id,m.Name));
}
return mlst;
}
我想根据选定的Category_ID 值获得不同的案例选择列表。
谁能告诉我为什么?因为我想基于相同的Category_ID 值运行一些查询。
【问题讨论】:
标签: salesforce apex custom-object