Currently I'm able to fetch all required fields from Opportunity as shown below:
import STAGE from '@salesforce/schema/Opportunity.StageName';
Similarly I need to fetch the Account fields which is linked to current opportunity but it is not working. This what I've tried:
import OPP_ACCOUNT_MY_CUSTOM_FIELD from '@salesforce/schema/Opportunity.AccountId__r.MyCustomField__c';
And I'm using getRecord() to fetch the Opportunity record as shown below:
const fields = [STAGE, OPP_ACCOUNT_MY_CUSTOM_FIELD ];
@wire(getRecord, { recordId: '$recordId', fields })oppId;
Trying to access the data with getFieldValue() as shown below:
let myCustomField = getFieldValue(data, OPP_ACCOUNT_MY_CUSTOM_FIELD );
What should be changed in the import to make this work?