I'm trying to create a visualforce page which clones the record type selection page when creating new Opportunities. I'd like the page to display opp record types based on the related account record type. Below is the code but I'm getting error this error:
Variable does not exist:currentAccount.RecordType.DeveloperName
public class myController {
public List<SelectOption> opts {get;set;}
private String oType {get;set;}
public Id recTypeId {get;set;}
myController(){
oType = 'Opportunity';
}
public List<SelectOption> myOptions() {
opts = new List<SelectOption>();
opts.add(new SelectOption('','--Please Select Record Type --'));
for(RecordType rts : [Select Id, DeveloperName, Name From RecordType Where SObjectType = 'Opportunity']) {
opts.add(new SelectOption(rts.id,rts.name));
}
Map<String,List<String>> mapping = new Map<String,List<String>>();
mapping.put('Small_Medium_Sized_Business', new List<String>{'Defined_Benefit_Retirement','Defined_Contribution_Retirement'});
return opts;
}
}
Edit to add Visual Force Page Code:
<apex:page standardController="Account">
<apex:form >
<apex:selectList value="{!recTypeID}" size="1">
<apex:selectOptions value="{!myOptions}">
</apex:selectOptions>
</apex:selectList>
<apex:commandButton value="Next" Action="{!continue}"/>
</apex:form>
</apex:page>
Can someone help me with this? Thanks!