Navigate to lightning from visualforce page

Bynayakdillip

Navigate to lightning from visualforce page

On visualforce page you need to add below code.If you need to redirect to lightning page on button click or page load .You use below code

<script>
 window.onload=function(){ 
 //get record ID
        var recordid='{!$CurrentPage.parameters.Id}';//Its depend open your record id
if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) {
            setTimeout(function(){
                // Salesforce1 navigation(Lightning Experience)
                sforce.one.navigateToURL('/'+recordid);
            }, 10);
}
}
</script>

About the author

nayakdillip administrator

Leave a Reply