[SalesForce] Save button didn’t redirect back in Lightning

I am working in lightning.

As Contact Role is not supported on Account in lightning. So am using visualforce page for account view and add Contact role related list as tab on Account. But when i click on New button to add contact role it will open in old salesforce and after click on save button it will not redirect back to lightning page.

How to redirect back to this in lightning.

Best Answer

Pritam, you can try to identify if you are in lightning or not by the code below and then redirect the user to the appropriate experience. I don't think that is the best solution in terms of UX, but is a way.

function isLightningExperienceOrSalesforce1() {
    return((typeof sforce != 'undefined') && sforce && (!!sforce.one));
}
Related Topic