I have a lightning-record-edit-form for Job__c with a lookup input to Labor_Category__c. Once a Labor_Category__c record is selected, I'd like to obtain the Labor_Category__r.Exempt__c value to then display. The getFieldValue() I'm using is just returning the Labor_Category__c record ID. I'd like to achieve this without having to call a custom apex method. Any ideas?
<lightning-record-edit-form object-api-name="Job__c" record-id={recordId}>
<lightning-input-field field-name="Labor_Category__c" onchange={handleChange} value={labCat}></lightning-input-field>
</lightning-record-edit-form>
JS:
import { LightningElement, api, track } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { getFieldValue } from 'lightning/uiRecordApi';
import EXEMPT_FIELD from '@salesforce/schema/Labor_Category__c.Exempt__c';
export default class customLWC extends NavigationMixin(LightningElement) {
labCat;
labCatE;
handleChange(event){
this.labCat = event.target.value;
this.labCatE = getFieldValue(this.labCat, EXEMPT_FIELD);
console.log('value = '+this.labCatE);
}
}