
Hello Everyone,
Need help to convert this simple Javascript button code to an lightning component
{!REQUIRESCRIPT("/soap/ajax/41.0/connection.js")}
var acc = new sforce.SObject("Account");
acc.Id = '{!Account.Id}';
acc.Account_Staus__c = 'Nurturing';
acc.OwnerID = '00541000002IuwH';
acc.Campaign_Bucket__c = 'False';
acc.Nurture_Button_Click__c='True';
var result = sforce.connection.update([acc]);
if (result[0].success == 'false') {
alert(result[0].errors.message);
}
else {
alert('Account is Nurtured and Owner Changed to Derek Thomas');
location.reload(true); /* redisplay the detail page */
}
The @Mohammed Rizwan . The Data service functionality will able to allow Deault values. Open record in Edit mode and Set values for Fields in recordUpdated function where we can use save record method from Data service. User no need to click on Save button. It will automatically update the record .
Please follow this link for more information
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/data_service_save_record.htm