7

I created a sample Lightning Component quick action as outlined in the documentation, Configure Components for Custom Actions.

<aura:component implements="force:lightningQuickAction">

    <!-- Very simple addition -->

    <ui:inputNumber aura:id="num1"/> +
    <ui:inputNumber aura:id="num2"/>

    <br/>
    <ui:button label="Add" press="{!c.clickAdd}"/>

</aura:component>

I then created a global action pointing to my Lightning component. So far, so good.

enter image description here

The action shows up as expected in the standard layout editor when I view the Salesforce1 & Lightning Actions in either an object page layout or in Global Actions > Publisher Layouts.

enter image description here

When I add the action to a page layout in this way, to the Salesforce1 and Lightning Experience Actions section of the layout, it appears in Lightning Experience as expected. Yay!

enter image description here

However, if I create a Lightning "App Page" in Lightning App Builder, my Lightning Component quick action doesn't appear in the list of available actions. All global Create a Record and Log a Call type actions appear, but the Lightning Component action does not.

enter image description here

enter image description here

Has anyone been able to add a Lightning Component quick action to their Lightning App pages in Lightning App Builder?

UPDATE: I have tried implementing force:availableForAllPageTypes and force:appHostable (together and separately) - these did not work.

  • Can you please share your code to see if all is ok? did you implement force:appHostable? – Itai Shmida Feb 19 '17 at 13:53
  • I have shared the code and screenshots. I tried implementing - at different times - force:appHostable and flexipage:availableForAllPageTypes (which seemed like the more likely solution since Lightning App pages in Lightning App Builder are flexipages). Neither worked. – shannonsans Feb 19 '17 at 18:15
  • Try adding flexipage:availableForAllPage and see if that helps. – naruto-sfdc Feb 19 '17 at 20:24
  • Tried that (see my previous comment) - didn't help. – shannonsans Feb 19 '17 at 20:29
  • looks like only global actions are available to the quick action from app builder. I replicated the same issue in my dev box. – naruto-sfdc Feb 19 '17 at 21:27
2

This isn't supported in App Builder yet. It's definitely on our radar and is something we'd like to fix in a near term release (safe harbor).

| improve this answer | |
  • Just thought of this - since it's basically just a flexipage, could I add it manually through the MD API? – shannonsans Feb 28 '17 at 16:40
  • 5
    A year later, it seems still not to be working. – Christian Szandor Knapp Jan 16 '19 at 10:39
  • 1
    @ChristianSzandorKnapp It appears to be working now. Please see my answer for more details. – Robert Hyatt Jan 30 at 7:33
  • Still not working. @RobertHyatt's answer is for a regular Create a Record quick action, not a Lightning component quick action. – shannonsans Feb 3 at 22:26
0

I was able to get this to work.

First, go to global actions:

enter image description here

Then, click "new":

enter image description here

Then, add what you want it to do; I made a new global action to create a new campaign here:

enter image description here

Now it shows up as an available action on the flexipage:

enter image description here

If you are interested in making it happen programmatically, when I pulled from my scratch org with sfdx force:source:pull, quickActions/NewCampaign.quickAction-meta.xml was generated:

<?xml version="1.0" encoding="UTF-8"?>
<QuickAction xmlns="http://soap.sforce.com/2006/04/metadata">
    <optionsCreateFeedItem>true</optionsCreateFeedItem>
    <quickActionLayout>
        <layoutSectionStyle>TwoColumnsLeftToRight</layoutSectionStyle>
        <quickActionLayoutColumns>
            <quickActionLayoutItems>
                <emptySpace>false</emptySpace>
                <field>Name</field>
                <uiBehavior>Required</uiBehavior>
            </quickActionLayoutItems>
            <quickActionLayoutItems>
                <emptySpace>false</emptySpace>
                <field>IsActive</field>
                <uiBehavior>Edit</uiBehavior>
            </quickActionLayoutItems>
            <quickActionLayoutItems>
                <emptySpace>false</emptySpace>
                <field>ParentId</field>
                <uiBehavior>Edit</uiBehavior>
            </quickActionLayoutItems>
            <quickActionLayoutItems>
                <emptySpace>false</emptySpace>
                <field>Type</field>
                <uiBehavior>Edit</uiBehavior>
            </quickActionLayoutItems>
            <quickActionLayoutItems>
                <emptySpace>false</emptySpace>
                <field>StartDate</field>
                <uiBehavior>Edit</uiBehavior>
            </quickActionLayoutItems>
            <quickActionLayoutItems>
                <emptySpace>false</emptySpace>
                <field>EndDate</field>
                <uiBehavior>Edit</uiBehavior>
            </quickActionLayoutItems>
            <quickActionLayoutItems>
                <emptySpace>false</emptySpace>
                <field>Description</field>
                <uiBehavior>Edit</uiBehavior>
            </quickActionLayoutItems>
        </quickActionLayoutColumns>
        <quickActionLayoutColumns/>
    </quickActionLayout>
    <standardLabel>New</standardLabel>
    <targetObject>Campaign</targetObject>
    <type>Create</type>
</QuickAction>

and it was referenced like the built-in quick actions in the flexipage definition:

...
    <quickActionList>
        <quickActionListItems>
            <quickActionName>NewCampaign</quickActionName>
        </quickActionListItems>
    </quickActionList>
...
| improve this answer | |
  • This is a standard "Create a Record" quick action, not a Lightning component quick action. Lightning component quick actions are still not showing up in the list of available actions. – shannonsans Feb 3 at 22:26
0

This can be done using the Metadata API as suggested by @shannonsans

You can manually create a metadata file with the following content (edit caps fields):

<?xml version="1.0" encoding="UTF-8"?>
<QuickAction xmlns="http://soap.sforce.com/2006/04/metadata">
    <height>500</height>
    <label>YOUR LABEL</label>
    <lightningComponent>COMPONENT NAME</lightningComponent>
    <optionsCreateFeedItem>false</optionsCreateFeedItem>
    <type>LightningComponent</type>
    <width>-100</width>
</QuickAction>

Save the file as OBJECTNAME.ACTIONNAME.quickAction and then deploy.

Super big thanks to @shannonsans for giving us the idea to try.

| improve this answer | |

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.