[SalesForce] Visual force page and record type

I'm creating a custom visual force page that allow users to create a new record for a custom object.

I want understand if in the custom VF page i have the standard functionality of the record type:

-see different field according to the visibility of the page layout

-have different picklist values

I have found this resource:

Displaying Record Types

I have tried creating a custom visual force page and two record types.
The record types are linked to different page layout.In one of the two page layouts i have removed some fields.
Pressing the New button i can choose which of the two record types i want.
They open the same VF page,but i can see on my custom vf Page the same fields.

I would like to be able to show different fields on my custom VF page according to different record types.
Is not possible or is there something that i don't know?

Thanks in advantage for any advice.

BR.

Best Answer

On VisualForce pages you cannot use the 'standard' Page Layout Assignment settings, since that only works with standard page layouts. Also if you use a VisualForce page, there's no use adding or removing fields from the standard page layouts, since you define the page layout in your VisualForce page.

So what you need to do is add a 'rendered=' attribute to your inputfields, where it checks the recordType and based on that renders the inputfield or not.

The different picklist values should already work once you've chose a recordType for your record.

For more help you'd need to post your visualforce page here.

Related Topic