+ Start a Discussion
Andee Weir 17Andee Weir 17 

Call Quick Action from Aura

Hi.

We have a requirement to replace the Activity Timeline in the Account's side panel with a custom version that better meets our needs.  However we do not want to lose the functionality of creating a new Task/Meeting/Call that the Activity Timeline gives & would rethaer not spend time creating our own versions. 

My initial thought was to create an Aura compnent that was a wrapper of those quick actions e.g. :-

cmp:-
<aura:component implements="flexipage:availableForRecordHome" description="My Lightning Component">
    <lightning:quickActionAPI aura:id="quickActionAPI" />
    <div>
        <lightning:button label="New Event" onclick="{!c.newEvent}"/>
    </div>
</aura:component>
Controller :-
({
    
    newEvent : function( cmp, event, helper ) {
        var actionAPI = cmp.find("quickActionAPI");
        var args = {actionName: "Event.New_Meeting_Retail"};
        actionAPI.selectAction(args).then(function(result){
            //Action selected; show data and set field values
        }).catch(function(e){
            if(e.errors){
                //If the specified action isn't found on the page, show an error message in the my component
                console.error(e.errors);
            }
        });
    }
})

The quick Action looks like :-
screenshot of quickaction& my user's profile has access to the record type :-
screenshot of recordtype access
The quick action itself already exists on the page layout (hence why it appears in the Activities Timeline).

I've added the component to the side panel & the button appears but when I click it, nothing happens.  In the console log I see 'The action you specified isn’t available on the current record page.'

Also tried it with a create case record but same result.  Works fine if the quick action calls a flow.

Any help gratefully received!
ravi soniravi soni
hi Andee,
did you add the action button on current recordPage. this lightning:quickActionAPI will work when button is added on record page.
thank you