I am trying to get all the record type options for Opportunity. I am using getObjectInfo directly copied from the documentation but I keep getting the same error:
Documentation: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_wire_adapters_object_info
JS:
import { LightningElement, track, wire, api } from 'lwc';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
import OPPORTUNITY_OBJECT from '@salesforce/schema/Opportunity';
export default class New_Opportunity extends LightningElement {
@api recordId;
@track objectInfo;
@wire(getObjectInfo, { objectApiName: OPPORTUNITY_OBJECT })
objectInfo;
get recordTypeOptions() {
console.log('options ', this.objectInfo.data.recordTypeInfos);
}
connectedCallback() {
console.log('recordId: ', this.recordId);
console.log(JSON.stringify(this.objectInfo));
}
}
I am really unsure why this is not working as I have directly copied the code