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
jishan royjishan roy 

I have to create quick action button to show the account related contacts in lightning web component.

please anybody help me out of this i am a fersher on lwc.

thanks in advance.
AnkaiahAnkaiah (Salesforce Developers) 
Hi Jishan,

Refer the below link will help you to proceed further.

https://www.sfdckid.com/2019/08/salesforce-lightning-component-to-display-contacts.html

Thanks!!
jishan royjishan roy
I have to create quick action in lwc.
AnkaiahAnkaiah (Salesforce Developers) 
Refer the below links.
https://www.salesforceben.com/create-lightning-web-components-lwc-using-quick-actions/

https://www.codekiat.com/2020/04/how-to-pass-record-id-from-lightning-web-component-to-apex-controller.html
AnkaiahAnkaiah (Salesforce Developers) 
Hi Jishan,

Try with below code  and I have tried in my demo org its working.

AccountRealedContacts.html
<template>
    <lightning-card title="LWC Record Id Example ">
        <lightning-datatable data={contacts} columns={columns} key-field="Id">
        </lightning-datatable>
    </lightning-card>   
</template>
AccountRealedContacts.js
import { LightningElement, track, wire, api } from 'lwc';
import getContactsRelatedToAccount from 
'@salesforce/apex/LwcController.getContactsRelatedToAccount';
export default class AccountRelatedContacts extends LightningElement {
    @api recordId;
    @track contacts;
    @track columns = [
        { label: 'First Name', fieldName: 'FirstName', type: 'text' },
        { label: 'Last Name', fieldName: 'LastName', type: 'text' },
        { label: 'Email', fieldName: 'Email'}
    ];

    @wire(getContactsRelatedToAccount, {accId: '$recordId'}) 
    WireContactRecords({error, data}){
        if(data){
            this.contacts = data;
            this.error = undefined;
        }else{
            this.error = error;
            this.contacts = undefined;
        }
    }
}
AccountRealedContacts.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordAction</target>
      </targets>
</LightningComponentBundle>

Apex Class:
 
public class LwcController {
    @AuraEnabled(cacheable=true)
    public static List<Contact> getContactsRelatedToAccount(String accId) {
        system.debug('accId >> ' + accId);
        return [SELECT Id, FirstName, LastName, Email, Phone from Contact where AccountId = :accId];
    }
}

If this helps, Please mark it as best answer.

Thanks!!​​​​​​​