+ Start a Discussion

Is there a way to copy/clone a standard SF page?

Hi there,


I'm facing the following challenge.


We have a number of different views when looking at cases and when you click a case you're taking to the case detail overview. All standard functionality.


Now, if you, on the detail overview, click the delete button you're redirected back to the most recent cases screen. However, we'd like to return to the view we came from (i.e. the screen where we clicked on the case).


What's the best way of achieving that functionality? Is it by creating a custom delete button or maybe overwriting the existing one? Or do we have to create a Visualforce Page which basically will be a clone of the case detail overview but with a slightly different delete button? And, if so, how is this done?


All help is much appreciated.




/Søren Nødskov Hansen


This is a tough one. I don't think overrides are going to help you here unless you always want to send the user to the same place on case delete, in that case an override of the delete button will work for you. Create a Visualforce page with the standardController for case, write an extension class in apex with your own delete action that sends the user to the desired location, bind your page's action attribute to that method and you should be good.


If you don't *always* want to send the user to the same place after delete because of the way salesforce navigation works you need to know where you were effectively at the time the user invokes delete and we don't keep that information around on the standard detail page which is why you are always ending up on the case tab after a case is deleted from the detail page.


If the place you were is always a Visualforce page AND your case detail page is a visualforce page you can manage this interaction by sending a parameter from one Visualforce page to another and then use the value of that parameter to generate the navigation in your own delete action method.


If the place you were isn't always a Visualforce page OR your case detail page is NOT a visualforce page then there really is no solution for you as you need to plug into standard salesforce navigation behavior and there is no mechanism for that today.