I have a simple VF page embedded in the detail page of the Contract object. The VF page is designed to replace the standard buttons on the detail page since one of the buttons needs to only appear if one of the fields in the Contract record has a certain value. All works as planned. However, when I click the Edit button, I am brought to the standard Edit page for the Contract object. If I click Cancel, I am brought back to my VF page only and not the Detail page where it is embedded. Is there anyway I can redirect to the original detail page without using a controller?

<apex:page standardController="Contract" >
<apex:form target="_parent">
<div style="text-align: center"><p/>
    <apex:commandButton Value="Edit" action="{!Edit}"/>
    <apex:commandButton Value="Delete" action="{!Delete}"/>
    <apex:commandButton Value="Clone" action="{!URLFOR($Action.Contract.Clone,Contract.id)}"/>
    <apex:commandButton Value="Amend" OnClick="window.open('/apex/VF_Quote','_parent');" rendered="{!Contract.Status <> 'Executed'}"/>

1 Answer 1


You need to set the return URL in the Edit & Clone as the following

<apex:commandButton value="Edit" action="{!URLFOR($Action.Account.Edit,Account.Id,['retURL'='/'+Account.id])}" />
  • Worked great, thanks!
    – J. Neilan
    Commented Aug 25, 2018 at 22:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .