3

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
}
  • Did you get any answer? I am getting the same error. – disasterlooms Jun 22 '18 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. – disasterlooms Jun 22 '18 at 17:18
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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.