I have two custom objects, Category and Case, I set category as parent. Column Category_ID in category is referenced by custom object Case. I executed two queries in developer console
SELECT Category_ID__c,id, Name FROM Category__c SELECT Category_ID__c,id, Name FROM Case__c and I found out the value of Category_ID in Case was like 'a0D'F000001MmjUae' and 'a0D'F000001MmjUde',yet in Category it's '0' and '1'.
VisualPage
<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;
}
I want to get different Case selectList based on selected Category_ID
value.
Anyone can tell me why? Because I want to run some queries based on the same Category_ID
value.