I have a VF page and it is associated with standard controller. On the page, I am using apex:detail tag to bring all the details. I also want to show few related list, So I used apex:relatedlist. This all works fine. The only thing which is problemtic is when I click on "New" button on related-list to create a new record after saving the record it doesn't bring me back to the original VF page, instead it takes me to the detail-page of related-list record. Any thoughts what wrong I am doing?

<apex:page standardController="Account">
You're looking at some related lists for {!account.name}:</apex:pageBlock>
<apex:relatedList list="Opportunities" />

<apex:relatedList list="Contacts">
    <apex:facet name="header">Titles can be overriden with facets</apex:facet>

<apex:relatedList list="Cases" title="Or you can keep the image, but change the text" />

  • 2
    I think this is the standard behaviour.You may overwrite standard Save button to change the navigation back to parent view . – Mohith Shrivastava Nov 26 '12 at 4:04
  • Does this mean I have to create another VF page for creating New Record and inside controller I will have to override save? – doga Nov 26 '12 at 4:13
  • Ya that can be done as well.But you can override save action as well .Override the Save Action – Mohith Shrivastava Nov 26 '12 at 7:24

This question has been asked before in a slightly different way, but the answers and sample code I believe still apply. Check out, Redirecting back to original page using visualforce.

  • 3
    Intrestingly both the questions are by the same user :X!!! – Rao Jan 25 '13 at 17:59

Since you are using standard controller, your save will behave the way it behaves when you save a record. And the problem here is, you cant override your Save button. You'll need to create a vf page and implement the save in your controller for that page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.