Visualforce Dispatcher Revisited

Funny how things can work just fine for the longest time and then you get a head scratcher. I just ran across an issue with my Visualforce dispatcher class which allows you to control which page to take a user to based on the record type being created.

The problem was that a user had selected in the settings to bypass the record type selection page and always use their default. Turns out when a user does that, the record type Id isn’t passed to your dispatcher page as a parameter. A Google search turned up this Stack Exchange question and I was able to solve the issue by looping through the record types and inspecting them to see if they are the default for that user. If it is, then we use it to determine which page to send the user to. I’ve updated the original Gist so you can use the code.

Leave a Reply