Below is a portion of my LWC js controller. I'm trying to write a function to see if a field in a parent record of an Event record has a certain value. I'm baffled by what is returned by getFieldValue(). It returns the entire Event record. That is demonstrated by the following console.log() statement. The line after that actually gets the field value and my function works correctly. I do not understand why the getFieldValue didn't give me the actual value and I needed the line that sets customFieldValue. Any ideas?
import { getFieldValue } from 'lightning/uiRecordApi'; import getEvent from '@salesforce/apex/MyCustomController.getEvent'; import CUSTOM_FIELD from '@salesforce/schema/Event.MyCustomObject__r.MyCustomField__c'; @wire(getEvent, { eventId: '$recordId' }) sfEvent; get isNotSomeValue() { const customField = getFieldValue (this.sfEvent.data, CUSTOM_FIELD); console.log(JSON.stringify(customField)); const customFieldValue = meetingStatus.MyCustomObject__r.MyCustomField__c; console.log("customFieldValue => " + customField); return ( customFieldValue != 'SomeValue'); }