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

m unable to get reord types as picklist values...can anyone help solve this issue
<apex:page controller="getrecordtype">
<apex:form >
YEAR<apex:selectList Size="1">
<apex:selectOptions value="{!items}"></apex:selectOptions>
</apex:selectList>
<apex:selectList >
<apex:selectOption value="{!RecordTypeSelectedId}"></apex:selectOption>
</apex:selectList>
</apex:form>
</apex:page>
------------------------------------------------------------------------------------------------------------
public with sharing class getrecordtype {
public String getRecordTypeSelectedId(){
String recordTypeName;
String rtId;
List<RecordType> rtList = New List<RecordType>([Select ID, Name From RecordType Where sObjectType = 'contact']);
for(RecordType rt : rtList) {
if(rt.Name == recordTypeName) {
rtId = rt.Id;
}
}
return rtId;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('2014','2014'));
options.add(new SelectOption('2015','2015'));
options.add(new SelectOption('2016','2016'));
return options;
}
}
<apex:form >
YEAR<apex:selectList Size="1">
<apex:selectOptions value="{!items}"></apex:selectOptions>
</apex:selectList>
<apex:selectList >
<apex:selectOption value="{!RecordTypeSelectedId}"></apex:selectOption>
</apex:selectList>
</apex:form>
</apex:page>
------------------------------------------------------------------------------------------------------------
public with sharing class getrecordtype {
public String getRecordTypeSelectedId(){
String recordTypeName;
String rtId;
List<RecordType> rtList = New List<RecordType>([Select ID, Name From RecordType Where sObjectType = 'contact']);
for(RecordType rt : rtList) {
if(rt.Name == recordTypeName) {
rtId = rt.Id;
}
}
return rtId;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('2014','2014'));
options.add(new SelectOption('2015','2015'));
options.add(new SelectOption('2016','2016'));
return options;
}
}
The updated class and the VF page. Hope this helps you
All Answers
The updated class and the VF page. Hope this helps you
<apex:page controller="getrecordtype">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
YEAR
<apex:selectList Size="1">
<apex:selectOptions value="{!items}">
</apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
RECORD TYPE
<apex:selectList size="1" >
<apex:selectOptions value="{!RecordTypeItems}">
</apex:selectOptions>
<apex:actionSupport event="onchnage" rendered="amountfields"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem id="amountfields">
<apex:repeat value="{!getamount}"></apex:repeat>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
----------------------------------------------------
public with sharing class getrecordtype {
map<id,AggregateResult> clist1 = new map<id,AggregateResult>();
public string selectedrecordtype{get;set;}
List<RecordType> rtList = New List<RecordType>([Select ID, Name From RecordType Where sObjectType = 'contact']);
public String getRecordTypeSelectedId(){
String recordTypeName;
String rtId;
//List<RecordType> rtList = New List<RecordType>([Select ID, Name From RecordType Where sObjectType = 'contact']);
for(RecordType rt : rtList) {
if(rt.Name == recordTypeName) {
rtId = rt.Id;
}
}
return rtId;
}
public List<SelectOption> getRecordTypeItems() {
List<SelectOption> options = new List<SelectOption>();
for(RecordType r : rtList){
options.add(new SelectOption(''+r.ID,r.name));
}
return options;
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('2014','2014'));
options.add(new SelectOption('2015','2015'));
options.add(new SelectOption('2016','2016'));
return options;
}
public map<id,AggregateResult> getGetamount() {
for(AggregateResult ar :[select sum(PAID_AMOUNT__c) s ,sum(BALANCE_AMOUNT__c) a ,sum(amount__c) c,accountid from contact where Recordtype = 'selectedrecordtype' group by accountid] ){
clist1.put((Id)ar.get('accountid'),ar);
}
return clist1;
}
}
You were missing some syntax