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

LWC display related account fields

How do I display the fields from a person account related to an opportunity (mine happens to be custom)?

Simple code example below. How do I display fields from the related person account based on the AccountId__c? Do I need a separate component? if so, how do I connect them?
import { LightningElement, api } from "lwc";

import NAME_FIELD from "@salesforce/schema/lda_Opportunity__c.Name";
import ACCOUNT_FIELD from "@salesforce/schema/lda_Opportunity__c.AccountId__c";

export default class SimpleDeal extends LightningElement {
  @api recordId;
  @api objectApiName;

  objectApiName = "lda_Opportunity__c";
Corresponding html:
    <lightning-card title="Deal Info" icon-name="custom:custom14">
Thanks in advance.
Xoel Rodriguez CostaXoel Rodriguez Costa
I could display contact fields in an LWC account form doing the following:
import ACCOUNT_NAME from "@salesforce/schema/Account.Name";
const FIELDS = [ACCOUNT_NAME, {"fieldApiName":"FinServ__TaxId__pc","objectApiName":"Account"}];
// where "FinServ__TaxId__pc" could be any contact field