Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import { LightningElement, wire, api, track } from 'lwc';
  2. import { getRecord } from 'lightning/uiRecordApi';
  3.  
  4. export default class Poc extends LightningElement {
  5. @api recordId;
  6. @track account;
  7.  
  8. @wire(getRecord, { recordId: '$recordId', fields: [ 'Account.Name', 'Account.Phone' ] })
  9. getaccountRecord({ data, error }) {
  10. console.log('accountRecord => ', data, error);
  11. if (data) {
  12. this.account = data;
  13. this.processRelatedObjects();
  14. } else if (error) {
  15. console.error('ERROR => ', JSON.stringify(error)); // handle error properly
  16. }
  17. }
  18.  
  19. processRelatedObjects() {
  20. console.log('processRelatedObjects for => ', JSON.stringify(this.account));
  21. // further processing like refreshApex or calling another wire service
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement