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
enossirenossir 

Do you need the lightning:button component if the aura bundle is executed via a lightning quick action??

For example i have a JS button i'm converting, and the lightning component that will replace it will only be excuted via a lightning quick action.
 
{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/36.0/apex.js")}

var div = document.createElement("div");

div.innerHTML = '<div style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.25; z-index: 1000; background-color: black;">&nbsp;</div><div style="position: fixed; left: 0; top: 0; bottom: 0; right: 0; z-index: 1001; margin: 15% 50%"><div style="display: inline-block; padding: 2px; background-color: #fff; width: 125px;"><img src="/img/loading.gif" style="float: left; margin: 8px;" /><span style="display: inline-block; padding: 10px 0px;">Please Wait...</span></div></div>';

document.body.appendChild(div);

window.setTimeout(function() {
sforce.apex.execute(
"SVC_Problem_Affected_Customers_Service",
"runFromButton",
{ actionName: "all", relevantId: "{!Account.Id}" }
);
window.location.reload();
}, 500);

There's the JS button

 
<aura:component controller="SVC_Affected_Customers_Service" implements="force:lightningQuickAction,force:hasRecordId" >
<aura:handler name="init" value="{!this}" action="{!c.runMethod}"/> 
</aura:component>

Component
 
({
	runMethod : function(component, event, helper) {
        
         var action = component.get("c.runFromButton");
         var actionName = all;
		 var relevantId = component.get("v.recordId");
         
        action.setParams({"actionName" : 'all' , relevantId : component.get("v.recordId")});
        actions.setCallBack(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var result = response.getReturnValue();
                console.log(result);
                $A.get('e.force:refreshView').fire();
            }
        })
         $A.enqueueAction(action);
  	}
})

Handler

And yes i hardcoded a var in there to equal all. Because the webservice does a check.

But back to the original question, if this is only being executed via a lightning quick action (ie a button that executes this component) do i need anything else in the component section? Google foo is failing me and the dev PDF's dont really cover this.
Raj VakatiRaj Vakati
As you are doing on init method .. your quick action will execute the logic and you dnt need to have any extras button 

But Change Code as below 
 
({
	runMethod : function(component, event, helper) {
        
         var action = component.get("c.runFromButton");
         var actionName = all;
		 var relevantId = component.get("v.recordId");
         
        action.setParams({"actionName" : 'all' , relevantId : component.get("v.recordId")});
        actions.setCallBack(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var result = response.getReturnValue();
                console.log(result);
                $A.get('e.force:refreshView').fire();
				var dismissActionPanel = $A.get("e.force:closeQuickAction");
dismissActionPanel.fire();
            }else{
			console.log('Error' +response.getError());
			}
        })
         $A.enqueueAction(action);
  	}
})