LWC as QuickAction in Salesforce

I have made a quick action in lightning web component and want ot make that compponent available for quick action. I havenot found any guide or documentation regarding this. Can you please suggest on how to make the lwc available for quick action.

Answer

[EDIT] Starting the Summer ’21 release, you be able to use lightning web components directly as a Quick Action as described here.
You’ll just need to set the myComponent.js-meta.xml metadata file accordingly:

<?xml version="1.0" encoding="UTF-8" ?>
<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>

The original answer is still valid for some use cases where Lightning web components are not supported yet, like Global Actions. [/EDIT]

Original answer:
This is not supported yet. You can have a look to what’s supported and what’s not here.
What you can do is wrap your Lightning web component in an Aura component:

<aura:component implements="force:lightningQuickAction">
    <c:myLwc></c:myLwc>
<aura:component>

If you need to send events like force:closeQuickAction, you’ll have to first send an event to the enclosing Aura component, so that it could fire this action. More on this here.

Attribution
Source : Link , Question Author : Muhammad Sheheryar Afsar , Answer Author : Fabien Taillon

Leave a Comment