[SalesForce] URLFOR($Action.Account.Edit,Account.Id,null,true) redirects to edit page but unable to save or cancel

I'm using Account edit button override with custom visualforce page. In the visualforce page, it correctly redirects to that particular Account edit page, but the save and cancel button doesnt doesnot working click standard edit layout. Itstays in the same page and doesn't redircts back after saving/cancelling. Here is the page :

<apex:page standardController="Account" action="{!IF(
 (Account.RecordType.Name=='Engagement Plan'|| Account.RecordType.Name=='Strategic Initiative')
, URLFOR($Action.Account.Edit,Account.Id,null,true)
, '/apex/test_kk?id=Account.Id'
)}" >
<apex:variable value="{!Account.RecordType.Name}" var="recTypeName"/> 
</apex:page>

Can anyone help me what i'm missing here? thanks!

Best Answer

You need to include the appropriate URL params that tell the standard Save (saveURL) and Cancel (retURL) buttons where to go. These should go in your URLFOR function where the null currently is:

URLFOR($Action.Account.Edit,Account.Id,['retURL'=cancelDestination, 'saveURL'=saveDestination],true)

Related Topic