You need to sign in to do that
Don't have an account?

sforce.one.navigateToURL not working in Visualforce page
Hi,
I am totally new with lightning and I am trying to switch some objtects from classic to lightning.
I have one visualforce page that checks one variable, and if it is true it redirects to another direction.
In classic it uses the "window.location.href", but it won't work with lightning, so I have added the following code:
even if I put the sforce.one.navigateto alone it does not work.
any suggestion?
Thanks
I am totally new with lightning and I am trying to switch some objtects from classic to lightning.
I have one visualforce page that checks one variable, and if it is true it redirects to another direction.
In classic it uses the "window.location.href", but it won't work with lightning, so I have added the following code:
<apex:form id="form"> <apex:outputPanel rendered="{!$User.UIThemeDisplayed == 'Theme4d'}"> <script type="text/javascript"> var precondition = {!Lead.Conversion_Precondition__c} || {!ISBLANK(Lead.RecordTypeId)}; if(precondition){ String url="{!URLFOR($Action.Lead.Convert, Lead.Id, [retURL='/' + Lead.Id, nooppti=1, IsReminderSet_fu=0], true)}"; sforce.one.navigateToSObject(url); } </script> </apex:outputPanel> <apex:outputPanel rendered="{!$User.UIThemeDisplayed == 'Theme3'}"> <script type="text/javascript"> var precondition = {!Lead.Conversion_Precondition__c} || {!ISBLANK(Lead.RecordTypeId)}; if(precondition){ window.location.href = "{!URLFOR($Action.Lead.Convert, Lead.Id, [retURL='/' + Lead.Id, nooppti=1, IsReminderSet_fu=0], true)}"; } </script> </apex:outputPanel>
even if I put the sforce.one.navigateto alone it does not work.
any suggestion?
Thanks
sforce.one.navigateToURL('/apex/VFPageName?RecordType=recordtypeid');
sforce.one.createRecord('Account', '{!AccountRecordTypeId}');
The problem was not with the function (sforce.one.navigateToURL) but with the url I tried to open.
Thanks for your help Laxman