You need to sign in to do that
Don't have an account?
Varun Annadata
displaying visual force page according to the record type selected using apex code and visual force
my requirement is this:
first i need to create two record types for a standard object lets suppose for account
then using custom setting i linked the record type and visual force page
then using the apex code i have to display the correct visual force page according to the record type.
can anyone suggest the code for this
first i need to create two record types for a standard object lets suppose for account
then using custom setting i linked the record type and visual force page
then using the apex code i have to display the correct visual force page according to the record type.
can anyone suggest the code for this
Hi Varun,
As DML operation is not supported with Record type, ou cannot create Record type using Apex. You have to create record type manually for any object.
You can create custom setting with Record Type Name Or Developer Name, I would suggest to use Developer Name instead of Name.
If you have two sets of pages then you can directly pass Record type ID and visualforce page (Based on Record type) on Custom Java Script button that will be operate from record detail page.
OR if you have one visualforce page, then you can fetch Record Type Name in your controller and based on Record Type you can show/hide fields or sections in your page.
I hope it helps you.
Thanks,
Yogesh Sharma
There are multiple ways for this - (you can also derive record type values in below code from a custom setting and set your conditions accordingly)
1) you can user an action method in the VF page and then in the controller use the setredirect() for navigation.
2) You can also use render, re-render attributes in your VF pages to display fields based on record type
3) If the display is subjected to a group/set of fields, you can go for a field set and render them in your VF page
https://developer.salesforce.com/forums/?id=906F0000000998aIAA (just a sample)
Get the recordtype values using custom setting method
and then pass this string variable to PageReference redirect -'
and by querying using soql i will get the recordname
can anyone tell how to get the vf page related to the recordname from custom setting using code?