function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PedroLPedroL 

Setting Records Type and Other Fields on a Visualforce page

Hello,

 

I would like to override the default edit page for Cases as we are using them extensible with many records types. Instead of letting the user create a case and select any records type, we are restricting where they might actually create the cases from. For this we are creating custom button that will call the appropriate Visualforce page.

 

I would like to know how to set the record type in the visualforce page as I will have one button per record type. To avoid creating many buttons, I would also like to determine where the calling record so I can set up some default data. For example, if the case is being created from the Contact, I would like to set the Contact and Account information.

 

Thanks,

 

Pedro

Ispita_NavatarIspita_Navatar

For setting the recordtype in the visual force page you can have 2 approaches:-

1. Pass the recordtypes as a parameter, which can then be read from the URL and set accordingly

2. Alternatively as in your case you say that there is a different page for each record type so you can set the rcordtype in a hidden field which will be fixed everytime and then that field can be read and the record type set accordingly.

 

As of setting the value of Account and Contact for that you can pass the information as parameter and then get them in the landing page and set them.

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.