We are currently looking at upgrading to Lightning for some of our user base. We have overwritten several of the standard new button with VF pages due to customisation we have completed in our org. Depending on the record types users have access they are routed to various record creat pages. Below is an example of what we have done for account creation. For the majority of our users we want to route them to a custom VF page before they get to the standard account edit page but for others we want to route them directly to the standard account edit page. We have used Javascript for this but when lightning is enabled the functionality doesnt work for our subset of users who we want to route to the standard edit page. On clicking the new button the code appears to get stuck in a loop. Any thoughts on what we are missing.<apex:page standardController="Account"> <apex:includeScript value="/support/console/26.0/integration.js"/> <script> var url = ''; if({!Account.RecordTypeId != "0120q0000004IdB"} && ({!$User.ProfileId != "00e0q000000LryaAAC"} || {!Account.RecordTypeId != null})){ <!-- Brands Account Record Type--> url = '/apex/accountDimensionSelectionPage?RecordType={!$CurrentPage.parameters.RecordType}'; }else{ url ='/001/e?ent=Account&RecordType={!$CurrentPage.parameters.RecordType}&CF00N80000004Wugx=.Distributor[No Hierarchy]&nooverride=0'; } parent.location.href=url;</script> </apex:page>ThanksEdel