• Xoel Rodriguez Costa
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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";
  fields = [NAME_FIELD, ACCOUNT_FIELD];
}
Corresponding html:
<template>
    <lightning-card title="Deal Info" icon-name="custom:custom14">
        <lightning-record-form
            record-id={recordId}
            object-api-name={objectApiName}
            fields={fields}>
        </lightning-record-form>
    </lightning-card>
</template>
Thanks in advance.