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
Rachel Linder 20Rachel Linder 20 

New Lightning Quick Action Is Not Working as Expected

We have an  Apex Class that runs nightly through a batch. We created a Lightning Quick Action so that this can also be invoked at any time during the day if needed.

We created it in our Dev box. But in order to test it we had to rebuild it in our full copy Sandbox. We created from scratch because we couldn't find a way to move this via a change set. 

When we click the button to test it it opens a blank window. Here is the screenshot of where the button sits:

User-added image

Here is a screenshot of what happens when we click the button:

User-added image

"SendToOrderDirectBatchPublicClass"
public class SendtoOrderDirectBatchPublicClass {
    @AuraEnabled
    public void getmyExecuteBatch() {
        
        SendToOrder_Subscriptions runSendToOrder_Subscriptions = new SendToOrder_Subscriptions();
        database.executebatch(runSendToOrder_Subscriptions,100);
        
        ContractRenewalManager runContractRenewalManager = new ContractRenewalManager();
        database.executeBatch(runContractRenewalManager,1);
    }
}

"SnedToOrderSubscriptions" (current name can we rename to correct Sned to Send?)
Description
A Lightning Component Bundle

Navigate to the bundle's definitions in the action bar to the right.

"SnedToOrderSubscriptionsController.js
({
    "clickClose" : function(cmp) {
       // Close the action panel
       var dismissActionPanel = $A.get("e.force:closeQuickAction");
       dismissActionPanel.fire();
   },

   "doInit" : function(cmp) {
        // create a one-time use instance of the DirectBatch action
        // in the server-side controller

        var action = cmp.get("c.myExecuteBatch");

        // Create a callback that is executed after 
        // the server-side action returns

        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                // Alert the user with the value returned 
                // from the server
                alert("Success from server: " + response.getReturnValue());
            }
            else if (state === "INCOMPLETE") {
                // do something
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                        alert("Error from server:" + errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        $A.enqueueAction(action);
    }
})

"SnedToOrderSubscriptions.cmp"
<!--quickLaunchBatch.cmp-->
<aura:component controller="SendToOrderDirectBatchPublicClass" implements="force:lightningQuickAction">

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <h1>Batch launched!</h1><br/>

    <lightning:button label="Close" onclick="{!c.clickClose}"/>

</aura:component>
I am not a developer so I am not sure where the problem is. Also, if possible we would like this button to be placed on a List View page. Will this change how this is built?