I am overriding the New button of a custom object using a Visualforce page. Now this vf page's controller does some calculation based on a criteria and assigns a record type to the newly created custom object, save the custom object and redirects the user to the newly created record.
However if the criteria is not met I want to send the user to the standard record type selection page, where they will select a record type and it will redirect them back to this same page where the code will read the selected record type, create a new record and then redirect the users to the new record page.
I am successfully able to redirect the user to the standard record type selection page using this url :
/setup/ui/recordtypeselect.jsp?retURL=%2Fa0G%2Fo&ent=01Ii0000000mXbK
However after selecting the record type I am not able to redirect them back to the vf page with the selected record type id.
I figured I needed the save_new_url parameter or I updated the link to
/setup/ui/recordtypeselect.jsp?retURL=%2Fa0G%2Fo&ent=01Ii0000000mXbK&save_new_url=/apex/MyVfPage
But its still not working.
What am I missing here?
Best Answer
not sure what you see when the redirection happens, but when I try the same in my dev org, it does redirect to the VF page from the record type selection page and the selected record type id comes in as a query string parameter.
here's the url in the record type selection page
and when i select a record type and click continue, i end up with this url
Note : I have used Case object in my dev org.. and don't think it will behave different for a custom object, so this should work for you as well.