Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created January 15, 2023 14:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save arun12209/4ebf463dcc209524e226e8f47eb2a470 to your computer and use it in GitHub Desktop.
import { LightningElement, track } from 'lwc';
import { MessageContext, subscribe } from 'lightning/messageService';
import ACCOUNT_SELECTED from './accountSelected.js';
export default class ReceiverComponent extends LightningElement {
selectedRecordId;
selectedRecord;
connectedCallback() {
subscribe(this.messageContext, ACCOUNT_SELECTED, this.handleSelectedAccount, { scope: APPLICATION_SCOPE });
this.messageContext = MessageContext.getInstance();
}
handleSelectedAccount(message) {
this.selectedRecordId = message.recordId;
//fetch selected record with the id
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment