2

I have created an LWC and wanted to create a headless Quick Action that uses it. I get the following error - "You can only create Quick Actions with actionSubtype matched with the Lightning Web Component you defined".

enter image description here

This action was previously created and worked flawlessly. Then a colleague deleted it and now I cannot recreate it again. Nothing has changed in the definition of the LWC or in the LWC itself.

This is what the definition looks like

<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<isExposed>true</isExposed>
<targets>
    <target>lightning__RecordAction</target>
    <target>lightning__RecordPage</target>
</targets>
<targetConfigs>
    <targetConfig targets="lightning__RecordAction">
        <actionType>Action</actionType>
    </targetConfig>
    <targetConfig targets="lightning__RecordPage">
        <supportedFormFactors>
            <supportedFormFactor type="Small" />
            <supportedFormFactor type="Large" />
        </supportedFormFactors>
    </targetConfig>
</targetConfigs>

And also the invoke method is in place

 @api invoke () {
    this.isAction = true;
    this.showButton = false;
    if(this.recordId && this.objectApiName) this.performHlsCheck();
}

As I mentioned above, this worked previously before it was deleted. Also it is being used flawlessly on other objects as a quick action. Anyone has any ideas? thanks in advance

3
  • Try removing <target>lightning__RecordPage</target> and its target config. Commented Dec 22, 2021 at 9:30
  • 1
    Hi Rahul, this makes sense and totally works. I am just wondering if this is documented somewhere? I am using this component on 3 separate objects as quick actions and also as a button on the record page ( for salesforce mobile app since lwc quick actions are not supported yet. This works fine. Now a colleague deleted the button on one object and this issue then occurred when I tried to recreate it. So this restriction seem to have come in with the latest release. Do you know if this documented anywhere?. Thanks again Rahul
    – Terry V
    Commented Dec 22, 2021 at 15:56
  • I don't think this is documented but its implicit that with headless action. You will need two separate components for this. Also if there is a lot of code that you don't want to replicate, create one base component and share the code with extension. Commented Dec 23, 2021 at 3:27

1 Answer 1

3

As Rahul mentioned, you have to remove the lightning__RecordPage target. This will work fine:

<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordAction</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordAction">
            <actionType>Action</actionType>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

As your component is meant to be an action without any UI, it doesn't make sense to add a target to be able to add it to the record page itself.

2
  • Hi Fabien, i totally agree with you. Unfortunately LWC for quick actions isn't supported for mobile app and my application is used on the desktop as well as the mobile app. So I got creative with my solution and use a button place on the record page in the mobile app to start my automation. At the time I created my LWC this was perfectly valid and worked fine. In fact it still works for all quick actions that already exist. Just wanted to give a bit of insight as to why I am using the same LWC as a headless quick action and also on a record page. Thanks for your reply
    – Terry V
    Commented Dec 22, 2021 at 15:58
  • I suggest you ask the question in the Trailblazer Community and mention Eric Shih, he is the PM, he may be aware of any change while saving your components: trailhead.salesforce.com/trailblazer-community/groups/… Commented Dec 22, 2021 at 16:03

You must log in to answer this question.

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