+ Start a Discussion
Huy NguyenHuy Nguyen 

2 record type in VF page

Hi all,

I have requirement to display 2 recordtype in one page. 2 section for example :client and employee. when I click new button it will display 2 page layout base on the recordtype . Could any one sugggest how to solve this requirement ?

 
ManojjenaManojjena
Hi ,

Can you clear  me one thing, that when you select the picklist and click on button it will redirect to the standrad page or custom page .
Huy NguyenHuy Nguyen
no . we did not select anything. the requirement required display 2 recordtype in one page . I will show you the image :

View Lobbyist - Dropdown re-renders screen to selected appointment
Add New - takes you to “Add New Employee” and “Add New Client” pages
Edit - Allows the user to edit the Active field against a Client or Employee
User-added image
Himanshu ParasharHimanshu Parashar
Hi Huy,

You can follow below logic

1. Create two different variable one is for Employee and one is for Clients and on change of your dropdown value query data from the database and assign to corresponding variable.
 
Public CustomObject__c objEmployee{get;set;}
Public CustomObject__c objClients{get;set;}

//init above object in constructor

//Your controller function which you call on dropdown change
public void LoadDetails()
{
   objEmployee = [select id from Customobject__c where recordtypeid='RECORDTYPEFOREMPLOYEE' AND //Other filters
   objClients = [select id from Customobject__c where recordtypeid='RECORDTYPEFORCLIENT' AND //Other filters


}
You can pass hard coded value of record type of you can query them as well.

Does it makes sense?

Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Huy NguyenHuy Nguyen
Hi Himanshu. it is for query data. How about the add new ?