+ Start a Discussion
The new LearnerThe new Learner 

Custom visual force page button Not working in lighting

Hi Experts,

Below is my code and i am new lighting , i have created a custom visualforce button its working fine in classic but its not working in lighting and also after clicking on that button its showing some black page , it has show to the same record page, can anyone help me pls. below is my code.
and my button behaviour is "BehaviorDisplay in existing window without sidebar or header"

<apex:page standardController="Account">
        <apex:includeScript value="../../soap/ajax/23.0/connection.js"/>
    var url = parent.location.href; 
    var updateRecords = []; 
    var update_account = new sforce.SObject("Account"); 
    update_account.id = "{!Account.Id}"; 
 update_account.List__c = "False";
       result = sforce.connection.update(updateRecords); 
       if (result[0].success=="true"){ 
       if(typeof sforce !== 'undefined') {
        } else {
window.location.href = document.referrer;
        alert("Failed to Update ");
Khan AnasKhan Anas (Salesforce Developers) 

I trust you are doing very well.

It is an Idea (https://success.salesforce.com/ideaView?id=08730000000cGX8AAM) to support Javascript Buttons in Lightning Experience.

However, you can use Lightning Experience Configuration Converter to convert JavaScript buttons to lightning. Please refer to the below links which might help you further with the above issue.




There are other options also to replace the javascript button in lightning. You can use Quick Actions, Custom Buttons, or Apex. Go through this trailhead module to understand the alternatives available:
Lightning Alternatives to JavaScript Buttons (https://trailhead.salesforce.com/en/modules/lex_javascript_button_migration)

Also, Please refer to the below links:


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas
Thomas FredThomas Fred
I want to insert a lightning component to a visualforce page after a button click is done in the visualforce page. So I want to do some vf-controller functions and then open a lightning component in the apex controller of the vf page https://mybkexperience.me.