function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC palaceSFDC palace 

Help Needed - Custom Button - Return URL

Hi,  wondered if anyone could help determine why my Return URL is not working on a custom button.
The above related to a new custom object related to the opportunity, on saving I would like it to return back to the opportunity.   I have tried lots of different options, even sending it to an external website to see what happens, but everytime it just takes me to the saved new record.
Is this not possible to do with custom objects, same code "retURL" works on custom event buttons.
Thanks for any assistance
your return url and save url should look like this:

retURL=%2F{Object.Id)&saveURL=%2F{Object.Id} These should both be the same object id's.

Let me know if this helps.

Thank you Jeremy, worked perfectly.
Just so I can understand more, are you able to explain how that works, and what the need of the Save URL is...  
Thanks again.
I believe the return URL is where you go if you cancel, and the Save URL is where you go when you save the new record.  If you don't use the Save URL then you will see the new record you just created rather than going back to the parent object.  You can try it out by removing the Save URL and testing the link.

Lewis HowelLewis Howel
Just for info, in LEX, "&retURL={!Opportunity.Link }" works for me
Jordan Wight 7Jordan Wight 7
@lewis howel, how did you get retURL to work in Lightning? It's not working for me.

&retURL={!Case.Link }
Lewis HowelLewis Howel
@jordan, yeah worked fine for me in LEX
Jordan WightJordan Wight
@lewis howel - can you share the details of your cuttom button? I would like to analyze what the difference is from mine, why mine is not working. See my URL example below, is your using the same syntax? Are you using the service console or sales? Custom URL button? Behavior - display in existing window without sidebar or header?

&retURL={!Case.Link }
In LEX 'retURL' or 'saveURL' is not working for me but was able to get it working using 'navigationLocation' and 'backgroundContext'.


I couldn't find possibe values for 'navigationLocation' other than 'RELATED_LIST' but it works even for detail page buttons. And 'backgroundContext' is appended automatically otherwise can be added explicitly as below


Troy CenterTroy Center
@Jordan Wright 7 I think you are missing a forward slash. Works fine. 

I have a button calling a flow doing something similar. /flow/Create_Queue_Item?LMID={!License_Management__c.Id}&retURL=/{!License_Management__c.Id}

See the Forward Slash... eg URL=/{!License_Management__c.Id}

Troy ~ Does that help?