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".
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
Best Answer
As Rahul mentioned, you have to remove the
lightning__RecordPage
target. This will work fine: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.