Steps to reproduce:

1) Create a VF page with below code and override Contact Edit button with this visualforce page.

<apex:page standardController="Contact" action="{!URLFOR($Action.Contact.Edit, Contact.Id, ['retURL'='/'+Contact.id],true)}">

2) In lightning experience and edit a contact record.

3) Record edit screen will open and save.

4) Issue is after save edit screen opens again.

I have also tried sforce.one.navigateToURL but found same results in lightning.

FYI, same code works perfect in Salesforce classic.


Try below steps: 1) in the action of apex:page tag decide which URL to navigate in a string and have return type as void.

2) Then if your navigation url is standard edit, please use sforce.one.editRecord(recordid) else use sforce.one.navigatetourl of you are in lightning.

3) if it is in classic, you can use window.location.

To decide if you are in classic or lightning use this if condition in a script

If(sforce && sforce.one){ //Ltng }else{ //Classic }

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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