function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BrianWXBrianWX 

Got error when create LWC Action in a Custom Object

I got this error when creating an LWC Action in a Custom Object.

Error: Invalid Data.
Review all error messages below to correct your data.
You can only create Quick Actions with actionSubtype matched with the Lightning Web Component you defined (Related field: Subtype)


dispatchIssue.html
<template>
   
</template>

dispatchIssue.js
import { LightningElement, api } from 'lwc';
export default class DispatchIssue extends LightningElement {
    @api invoke() {
        console.log("Hi, I'm an action.");
    }
}


dispatchIssue.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <masterLabel>Dispatch Issue</masterLabel>
    <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="Large" />
                <supportedFormFactor type="Small" />
            </supportedFormFactors>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

It was really odd.  I was able to create the Action, delete it completely, recompile, recreate the Action, but this time it threw this error....

Anything I missed here?
mukesh guptamukesh gupta
Hi Brain,

First you need to test below code:

Aftre that will check for supportedFormFactor
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <masterLabel>Dispatch Issue</masterLabel>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordAction</target>
        <target>lightning__RecordPage</target>    
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordAction">
          <actionType>Action</actionType>        
        </targetConfig>
     </targetConfigs>
</LightningComponentBundle>

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukes
BrianWXBrianWX
Thanks @Mukes.  I will get this tested and let you know soon.  Best.