Hi All,
We have a OnClick Java Script button and we are planning to move to the Lightning soon. Hence need help in creating a Lightning Component quick action.
As I am not aware about JavaScript, sharing the button coding as below:
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
var result = sforce.connection.query("Select id,Name,Geocoding_Status__c from Account where id = '{!Account.Id}'");
var accountRecords = result.getArray("records");
var arrayLength = accountRecords.length;
if(arrayLength>0){
for(var i=0;i<arrayLength;i++){
if(accountRecords[i].Geocoding_Status__c=='OK'){
var r = confirm('This will retrieve data from our data partner, Core Logic. Press OK to confirm.');
if(r==true){
var LeinCheck = sforce.apex.execute('LeinCheckCoreLogicIntegration','CoreLogicCallout',{id:'{!Account.Id}',conID:'{!Contact.Id}'});
sforce.debug.trace = true;
location.reload(true);
}else{
}
}else{
alert('Please correct the Account address for this Contact. Lien Check requires a valid address.');
}
}
}
Hi Nilesh,
As Praveen said, a quick action using a custom lightning component sounds like the best option here.
You will have to handle the query and the other function in an apex class that will be used in the component.
In the component you will define the UI, with the JS controller you call the Apex controller and decide what to do with the response.
Remember that the methods in the Apex class MUST have @AuraEnabled before the signature of the method and the component must implement "force:lightningQuickAction", and "force:hasRecordId" if you are updating of deleting the record.
Here is an example on how this works
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_lex_s1_config_action_recordid.htmHope this can help you.