How to get recordId and objectApiName in LWC Quick Action

 

How to get recordId and objectApiName in LWC Quick Action

#SFDCSasid #Salesforce #LightningWebComponent #QuickAction #objectApiName #recordId

  • FYI: Unlike other Lightning web components on record pages, LWC quick actions don’t pass in objectApiName and recordId in connectedCallback().
  • Impacted Scenario: The value of objectApiName and recordId is not available when the component is inserted into the DOM (i.e., within connectedCallback()).
html

js

js-meta.xml

connectedCallback - value is not available
  • Resolution:
    • Import the lightning-navigation service.
    • Assign the recordId and objectApiName from its wire adapter's state value.
js

connectedCallback - value is available



    Please share your feedback or comments or queries related to this post, on below comment section.

    Comments