I'm trying to avoid hardcoding Ids in my code. I want to do that with Custom Settings List 'TypeList' - got there field to hold record type ids 'TypeId'. Is there any chance to use Custom Setting List in SELECT FROM WHERE ?
Class:
public with sharing class contrlller{
public Id Current_Acc_Id {get;set;}
public contrlller(ApexPages.StandardController controller) {
Case caseObject = (Case)controller.getRecord();
Current_Acc_Id = caseObject.AccountId;
}
List<TypeList__C> mcs = TypeList__c.getall().values();
public List<Case> getrelatedCases(){
List <case> conList = new List<Case>();
for(Case relatedCase: [SELECT CaseNumber, Case_Type__c, OwnerId, Origin, Id FROM Case WHERE (RecordTypeId != '01220000000VD9K' AND IsClosed!=True AND AccountId =:Current_Acc_Id)]){
conList.add(relatedCase);
}
return conList;
}
}
VP
<apex:page standardController="Case" extensions="contrlller">
<apex:includeScript value="/support/console/29.0/integration.js"/>
<script type="text/javascript">
function openSubTab(recId){
var redirectUrl = recId;
if (sforce.console.isInConsole()) {
sforce.console.getEnclosingTabId(function(enclosingResult){
sforce.console.getEnclosingPrimaryTabId(function(primaryResult){
sforce.console.openSubtab(primaryResult.id, redirectUrl, true, '', null);
});
});
} else {
window.open('/'+redirectUrl,'name',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
}
}
</script>
<apex:form >
<apex:pageblock >
<apex:pageBlockTable value="{!relatedCases}" var="val">
{!Case.AccountId}
<apex:column headerValue="CaseNumber">
<a href="#" onclick="openSubTab('{!val.Id}');">{!val.CaseNumber}</a>
</apex:column>
<apex:facet name="header"><apex:outputText value="Open Customer Service Cases " style="color:red"/></apex:facet>
<apex:column headerValue="CaseNumber">
<apex:commandLink value="{!val.CaseNumber}" action="/console?{!val.Id}" target="_blank" />
</apex:column>
<apex:column value="{!val.RecordTypeId}"/>
<apex:column value="{!val.Case_Type__c}"/>
<apex:column value="{!val.OwnerId}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>