Skip to main content

I have some javascript buttons (List Button) on object, while running Configuration converter those  JS buttons are not showing in scan list.  

Is there any sample code to convert button into lightning actions and components. Any help is much appreciated. 

 

Below is sample code in classic for javascript button

 

{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit

{!REQUIRESCRIPT('/soap/ajax/33.0/apex.js')}

 

var url = parent.location.href; //string for the URL of the current page

var records = {!GETRECORDIDS($ObjectType.Account)}; //grabs the Account records that the user is requesting to update

var updateRecords = []; //array for holding records that this code will ultimately update

 

if (records[0] == null) { //if the button was clicked but there was no record selected

alert("Please select at least one record to update."); //alert the user that they didn't make a selection

}

if (records.length > 1) { //if the button was clicked but there was no record selected

alert("Please select only one record to update."); //alert the user that they didn't make a selection

}else { //otherwise, there was a record selection

for (var a=0; a<records.length; a++) { //for all records

var update_Account = new sforce.SObject("Account"); //create a new sObject for storing updated record details

update_Account.Id = records[a]; //set the Id of the selected Account record

sforce.apex.execute("ActiveAccount","ActiveAccount",

{AccountID : update_Account.Id});

}

//push the updated records back to Salesforce

parent.location.href = url; //refresh the page

}

댓글 1개
  1. 2019년 12월 18일 오후 2:10
    Hi @Mayur Gupta

    , You could check it on the "Files" tab in the "jsButtons-*" CSV file.

    This Conversion Type is Manual, because List view buttons aren't supported, as an alternative you could use a Custom Visualforce buttons on list views. Please have a look at this link below in the "Custom Visualforce buttons on list views" section

    https://trailhead.salesforce.com/en/content/learn/modules/lex_javascript_button_migration/javascript_button_alternatives
0/9000