I am trying to find a way to launch a Visualforce page after a record type is chosen during Case creation. We have a requirement to show different sets of values for one of our Record Types on the Case object. All other record types should remain as is according to standard SFDC functions. So when a user clicks to create a case, the Record Type drop down comes up (which we still want). However, if they select Record Type "A", it should re-direct them to a custom VF page. Any other Record Type selected should route them to the normal SFDC edit screen for a Case. I do not want to override the standard buttons, because that will affect all case creation. Any ideas on how I can accomplish this?
3there is no way to redirect except overriding standard button. As a solution you can override standard button and check inside the vf action method and redirect to specific vf page for Record type A and redirect to standard case layout for other record type.– HimanshuMay 6, 2016 at 17:50
@Himanshu - Thanks. Do you have a code example of how I would re-direct to the standard case layout?– J. NeilanMay 6, 2016 at 18:09
copy the url which you can see after selecting record type from picklist and put that inside a apex class action method.– HimanshuMay 6, 2016 at 18:41
so one way override new button with vf page and dont check the skip recordType checkbox. So now when you click on new button it will redirect to recordType selection page once recordType selected it will be redirect to vf page ..– Ratan PaulMay 6, 2016 at 18:48
I know you said you want to keep the original "Record Type Select" page, but perhaps you can consider creating a VF page to replicate the "RT Select" functionality and writing code in the backend to redirect to either the standard page or your custom VF page for the Record Type.
I don't normally advocate writing un-necessary VF but the thing I do not like about @Viasur's answer is that embedding a VF page inside of a standard PL potentially exposes you to a poor UX. You have to hardcode the height of the VF page and you can end up having a "Scrollbar within scrollbar" scenario.
I would evaluate the previous answer's feasibility and only implement it if you are ok with the UX pitfalls... I would bite the bullet, write one extra VF page to replicate the existing functionality (ugh) but gain the advantage of having more flexibility.
1I probably think that Sebastian's approach can be more beneficial than mine. It is cleaner but it needs a bit more of coding. If you need to redirect the user to a page that looks similar to the Case pages that you are already using, I will go for my approach, but if you need to totally change the page, the UX will be more gentle with Sebastian's idea. May 6, 2016 at 21:23
I think that the best way to accomplish this is as follow:
- You need to create the VF page that you want to use.
- Then you need to create a Case Page Layout
- On the new Case Page Layout you can add your VF. Remove any fields that are not needed and use your VF page as the main UI for that Case Page Layout.
- Now you have a Case Page Layout with an VF inside. Go to Set up--> Build-->Cases-->Record Types. Make sure you have a Support Process or it is not going to allow you to build a new record type.
- Build your new record type.
- Go back to the main Build-->Cases-->Record Types
- Select from the top "Page Layout Assignment"
- After that you just need to click on Edit Page Layout Assignment and assign the new Page that contains the VF page.
This should work.
Let me know otherwise.