Save Button Override: Redirect to Parent Record after clicking SAVE on the Child Record: Salesforce

5:31 PM

Problem description:

Let's take the scenario of Account - Contact. On the Account Detail page you have the Contact related list. When a user clicks on the 'New' button in the 'Contact' related list, a Contact Edit Screen shows up. When the user clicks 'Save' he is redirected to the 'Contact Detail Page'.

You want to redirect the user to the parent 'Account Detail Page' instead.


STEP 1:

Create a Custom button on Contacts as shown below.


STEP 2:

Analyzing the 'Button or Link URL':

/003/e?retURL=%2F{!Account.Id}&saveURL=%2F{!Account.Id}

003 - Denotes Contact (The child record, will be different for each object. Click on the standard NEW button of any object and you could find out the unique code for that object)

retURL=%2F{!Account.Id} - the URL you want to redirect the user to when he clicks CANCEL. %2F denotes a '/' and the merge field {!Account.Id} gives the Account to redirect to.

saveURL - similar to retURL except that it defines the URL to redirect to after the user clicks 'SAVE'

STEP 3:

Add the 'New' custom button to the Account Page Layout.

                         









4 comments

  1. Nice vijay... but the newly created contact is not associated to that particular account while creating we need to manually choose the account by this..while default functionality directly associates the contact to the account..if we do that it is more helpful

    ReplyDelete
    Replies
    1. Have a look at http://blog.deliveredinnovation.com/2012/09/17/create-a-custom-new-button-on-a-related-list-to-return-to-the-parent-record-after-clicking-save/

      Delete
  2. What if i want to a reverse scenario, if there was a child record and had to access it from a button on the Standard page.

    ReplyDelete
  3. Nashor, were you able to crack it ? I have a similar requirement..

    ReplyDelete