0

I have a VF page where logic is written and I am calling that VF page to other VF page using below syntax:

Sforce.one.navigateToURL(vfpageurl,true);

Where vfpageurl is url of VF page by setting some parameters

And this other VF page is added on quick action. It is working correctly in classic but in lighting when I click on button, it does not load the VF Page but if I refresh the page then it displays the page. Any idea why this is happening?

1 Answer 1

1

Navigation url to the target visualforce is not same for classic and lightning. You can do something like

  1. check, if you are in Lightning or Classic
  2. redirect to the url according to the environment

       if( (typeof sforce != 'undefined' && sforce && (!!sforce.one) ) {
            alert('test light');
    
            //here testVisualForcePageTab
            //sforce.one.navigateToURL("/lightning/n/testVisualForcePageTab", true);
    
        }else {
            alert('test classic');
            //navigate to vf page
        }
    
3
  • I tried but it said invalid url. URL I added was /lightning/n/apex/VFPageName.
    – SFDCDJ
    Nov 6, 2019 at 7:39
  • I can see that u want me to create VF page tab and then use the above url. This is working but my expectation is i want to call VF page directly as there are some parameters I am passing in VF.
    – SFDCDJ
    Nov 6, 2019 at 9:54
  • I think, you can pass your parameter in a query string format after the tab url like: sforce.one.navigateToURL("/lightning/n/testVisualForcePageTab?param1=value1", true); Nov 12, 2019 at 14:29

You must log in to answer this question.

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