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

Record type selection visualforce page
Hi,
I would like to create a visualforce page to customize the standard Opportunity record type selection page based on the Account's record type. For example,
Account record type = A, the Opp record type selection should only show opp record types 1,2;
Account record type = B, the Opp record type selection should only show opp record types 3,4
Can someone provide a sample code for me to start with?
I would like to create a visualforce page to customize the standard Opportunity record type selection page based on the Account's record type. For example,
Account record type = A, the Opp record type selection should only show opp record types 1,2;
Account record type = B, the Opp record type selection should only show opp record types 3,4
Can someone provide a sample code for me to start with?
1) Create a VF page with a StandardController of type "Account" (so you can add it to your Accountn layout)
2) Get all the recordtypes
3) Filter the recordtypes on point 2) based upon the Account.RecordTypeId or DeveloperName with a logic you own. For example you can create a Map that maps Account Recordtypes to Opportunity RecordTypes
And then filtering the query:
Now you can create a SelectOption list with all the recordtype you need.
This is a possibile implementation, you can also use an SObject to store the AccountRT/OpportunityRT association of a list custom setting to do it more configurable.
--
May the Force.com be with your
you can also review the below post that talks about replacing a standard record type selection page to custom
https://developer.salesforce.com/forums/ForumsMain?id=906F000000095W3IAI (http://https://developer.salesforce.com/forums/ForumsMain?id=906F000000095W3IAI)
Variable does not exist: currentAccount.RecordType.DeveloperName
Here's my code:
public class myController {
public list<SelectOption> getRecordTypes()
{
list<SelectOption> options = new list<SelectOption>();
for(RecordType sRecordType : [Select Id, DeveloperName, Name From RecordType Where SObjectType = 'Opportunity']){
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'});
List<RecordType> rTypeList = [Select Id, DeveloperName, Name
From RecordType
Where SObjectType = 'Opportunity' and DeveloperName
IN :mapping.get(currentAccount.RecordType.DeveloperName)];
}
return options;
}
}