Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created June 5, 2022 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun12209/b77b487600d14f555899f07f223be431 to your computer and use it in GitHub Desktop.
Save arun12209/b77b487600d14f555899f07f223be431 to your computer and use it in GitHub Desktop.
import { LightningElement ,wire,api} from 'lwc';
import { getRelatedListCount } from 'lightning/uiRelatedListApi';
export default class GetRelatedListCount extends LightningElement {
error;
responseData;
@api recordId;
//Account's related contact list count
@wire(getRelatedListCount, {
parentRecordId: '$recordId',
relatedListId: 'Contacts'
})listInfo({ error, data }) {
if (data) {
this.responseData = data;
//console.log('data: '+JSON.stringify(data));
this.error = undefined;
} else if (error) {
this.error = error;
this.responseData = undefined;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment