Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When we click on a item in the related list it takes us to that item record. But there is no way to come back to the page we clicked this link from. This works when you click on the new button which has a returl specified.

Is there a way when someone clicks on the link on the related list record and it has a cancel/back button to return back to page we clicked this link from?

enter image description here

share|improve this question
up vote 3 down vote accepted

Can you simply add a custom Javascript button to "Invoices Service" page layout that'd have

// or history.go(-1)
// or location.href = '/{!Invoice_Service__c.Invoice__c}';
// or same but with button type URL and not JS
// or if you really want - do something fancy with "Recent Items"?

Call the button "back to Invoice" or something?

Other than that - I guess you'd have to override view action with VF page, maybe even display <apex:detail> to salvage normal layout but do some crazy stuff in the controller... Not worth the effort I'd say.

Or teach your users about the "back" button in the browser, what happens when they click the lookup to "Invoice" etc ;) I'm not usability expert but I'd say you should have a good reason to make custom buttons like that ;)

P.S. I've also seen a project where they had very complex hierarchical data structure and they decided to implement kind of path on the top of the page (I think it's called "breadcrumbs").

share|improve this answer
agree VF is a bit of overkill for this. Would then need to implement for all the related lists. javascript with histroy should be worth the try. – Prady Jan 18 '13 at 8:01

You can create a new VF page and override this VF for 'View' button. In the vf page , you have to use java script to open the related salesforce native page and along with you can specify the return url.

for return url, use below code:

var referrer = document.referrer; alert(referrer);

This will give you the parent window address. So , when you will click on 'Cancel' button , you will come back to parent page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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