function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pooja NekkalapudiPooja Nekkalapudi 

convert a onclick JavaScript button to work in lightning

Im tryig to convert a JS button to work as lightning button or even could be a quick action
{!REQUIRESCRIPT('/soap/ajax/19.0/connection.js')}

function updatefield() {
var record = new sforce.SObject('CustomObject__c');
record.id = '{!CustomObjec__c.Id}';
record.CheckBox__c = 'true';
var records=new Array();
records[0]=record;
var result = sforce.connection.update(records);
if (result[0].getBoolean("success")) window.location.reload()
else alert(result[0].errors.message);
}
try{
updatefield();
}
catch(ex){
alert(ex);
}

According to this Im creating a update a record qucik action n pre defining the check box to true but it isnt quite working or may be Im reading the code wrong??
Ayush TripathiAyush Tripathi
Hi you can perform this using Quick Action
1 - Object -> Custom, Button and Links Section ->New Action
2-  Create a custom component having a button which would call your apex code.Your Custom Component can be a Custom Visualforce of Lightning Component (in Action Type while creating a Quick Action).
Please Refer the below link for more information

https://salesforce.stackexchange.com/questions/169021/javascript-button-on-lightning-experience