Which method is typically used to convert an on click javascript detail page button which utilizes the AJAX toolkit? Looking to call the "forwardEmails" method with the case ID and default value for settings name upon a click.



1 Answer 1


You just need three code parts: changing the Apex code, creating the component, and creating the controller.


Add @AuraEnabled to your method.

@AuraEnabled public static void forwardEmails(Id caseId, String settingsName) {
  // original code here //


It needs to be a quick action component.

<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" 
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />


   doInit: function(component, event, helper) {
     var action = component.get("c.forwardEmails");
     action.setParams({ caseId: component.get("v.caseId"), settingsName: "Default" });
     action.setCallback(this, function(result) {
       // Refresh the data
       // Close the quick action

From here, create a new Quick Action (Setup > Object Manager > Cases > Buttons, Links, and Actions > New Action). Select the component you just created for the quick action. After this, add the quick action to the page layout.

There are a few more "extra" pieces you could add (check the documentation for details), but this is the absolute bare-minimum that you need to change to perform the conversion.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .