• Thomas Fred
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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"/>
    <script>
    sforce.connection.sessionId='{!GETSESSIONID()}';
    var url = parent.location.href; 
    var updateRecords = []; 
    var update_account = new sforce.SObject("Account"); 
    update_account.id = "{!Account.Id}"; 
 update_account.List__c = "False";
updateRecords.push(update_account); 
 
       result = sforce.connection.update(updateRecords); 
       if (result[0].success=="true"){ 
       if(typeof sforce !== 'undefined') {
       sforce.one.back(true);
        
        } else {
window.location.href = document.referrer;
}
 }
        else
        alert("Failed to Update ");
        </script>
        </apex:page>