Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { LightningElement, wire, api, track } from 'lwc';
- import { getRecord } from 'lightning/uiRecordApi';
- export default class Poc extends LightningElement {
- @api recordId;
- @track account;
- @wire(getRecord, { recordId: '$recordId', fields: [ 'Account.Name', 'Account.Phone' ] })
- getaccountRecord({ data, error }) {
- console.log('accountRecord => ', data, error);
- if (data) {
- this.account = data;
- this.processRelatedObjects();
- } else if (error) {
- console.error('ERROR => ', JSON.stringify(error)); // handle error properly
- }
- }
- processRelatedObjects() {
- console.log('processRelatedObjects for => ', JSON.stringify(this.account));
- // further processing like refreshApex or calling another wire service
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement