6

I a not sure if this is possible but I am trying to fire a global action from a lightning component button click. Open to other solutions.

I tried implementing it using the lightning:QuickActionApi. But it doesn't seem to work. https://developer.salesforce.com/docs/component-library/bundle/lightning:quickActionAPI/documentation

Below is my Component:

<aura:component implements="force:appHostable, flexipage:availableForAllPageTypes, flexipage:availableForRecordHome, force:hasRecordId" access="global">

  <lightning:quickActionAPI aura:id="quickActionAPI" />

      <lightning:button label="Select Update Case Action" onclick="{!c.fireGlobal}" />


</aura:component>

Below is my Controller Code:

fireGlobal: function (cmp, event, helper) {
    var actionAPI = cmp.find("quickActionAPI");

    var args = { actionName: "NewContact" };
    actionAPI.invokeAction(args);
}

Error message:

{
        actionName:"NewContact",
        errors:["We can’t execute the API because the parent record isn’t selected."],
        parentContext:null,
        success:false,
        targetName:undefined,
        unavailableAction:true
}
2
  • Did you get any answer? I am getting the same error. Commented Jun 22, 2018 at 16:27
  • I did some trial and error and found that the action has to be on the record page. Once I added the publisher to the lightning page layout and the action to the page layout, I found that it worked. Commented Jun 22, 2018 at 17:18

3 Answers 3

3

I did some trial and error and found that the action has to be on the record page. Once I added the publisher to the lightning page layout and the action to the page layout, I found that it worked.

From what it looks like, this is very limited as you cannot call actions for child records on the parent record page. If there is a way, I would love to get help on it.

1
  • could you manage to make "NewContact" working? Commented Feb 7, 2020 at 13:46
1

It is limited, but you can at least use a "Create Record" quick action to create a child record. Then again you can't update a child record via a normal quick action anyways so it's limited to the options available which makes sense. The biggest use case I found it for was being able to launch the quick action layouts via a lightning component so you don't have to deal with the hassle of building out all of the markup or adding additional record types. Plus it's very admin-friendly to update.

0

You can still use it from the parent component if your parent component is not embedded into any record page. That means your recordId attribute is still empty in the component You can explicitly set the child's record Id in recordId attribute.

It works pretty well@ I have used it. :) Cheers! Mark this helpful if this answers your question to help community better.

Thanks

You must log in to answer this question.

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