You need to sign in to do that
Don't have an account?
Pooja 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??
{!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??
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