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
nyhansanyhansa 

Issue with Visualforce Page Override of Account Button

I've had to create a Visualforce Edit page for all Accounts. The Visualforce page has fields that render according to record type (i.e. render if Account is Person Account), this works fine when the Account already exists in Salesforce. When I go to create a new Person Account, Business Account fields, not Person Account fields, render on the Create New Edit page. Is this because the record has not yet been created in Salesforce? Is there any way to work around this issue? I figured it would work since before creating the record, I've already chosen the record type I'd like to be created. Do I need to create yet another custom Edit page to create a new Account? If so, how do I get the fields to render properly so I don't have users wondering why unecessary fields appear on the Create New page? Please let me know if you need more information from me.

NevurothNevuroth

Did you ever find a solution to this? I'm having a similar issue.

nyhansanyhansa

Hi Nevuroth,

 

I was able to find a solution for this issue. I ended up having to create a custom controller, a visualforce redirect page to override the new button, and a unique visualforce 'create' page for each record type. Someone directed me to a blog post by Delivered Innovation that I found extremely helpful. The post includes the Visualforce code for the redirect page as well as the Apex custom controller extension that you will need to create in order for the redirect page to get the user to the appropriate create page. I hope this helps. If you need a more case-specific example than what's included in the post, let me know and I'll post my controller extension here for you.