I`m struggling to fix an issue which arise with the new Salesforce Lightning Experience. So, I have a Visualforce page which is assigned to the Edit functionality of Accounts. In Salesforce Classic mode everything works perfectly good, but when I switch to the new Lightning Experience I get a strange behavior on redirect - the lightning is removed and I get redirected to the classic mode page. I hope to clarify things with the below screenshots.

First, I edit one of my accounts to go to my Visualforce page.

enter image description here

Second, I fill in the data in click save which should return me back to the account details page.

enter image description here

Unfortunately, the result is as folows:

enter image description here

I'm using PageReference object in my Apex controller for navigation, but from what I've red it is not working with the Lightning.

For example:

    PageReference pg = null;
    try{
        pg = stdController.save();  
    }catch(Exception ex){           
        Logger.Instance.LogException(ex, false);
    }

    return pg;

If anyone can give me directions, I would be very grateful!

Solution I have managed to solve this issue by invoking the controller methods which handled the navigation as <apex:actionFunction>. Also I have added a 'lightning experience check' in my controller to be able to return null in the PageReference methods so that navigation is handled by the javascript. In the complete event of the actionFunction's I managed the navigation with the sforce.one object.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.