I have what I feel like ought to be a super simple Lightning Web Component. I am showing this on a Tab in a record page for a Case.
Complete JS:
import { LightningElement, api, wire, track } from 'lwc';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import IS_CLOSED from '@salesforce/schema/Case.IsClosed';
const FIELDS = [IS_CLOSED];
export default class CaseCloseForm extends LightningElement {
@api recordId;
@wire(getRecord, { recordId: '$recordId', FIELDS })
record;
get isClosed() {
return getFieldValue(this.record.data, IS_CLOSED);
}
}
Complete HTML:
<template>
Record ID: {recordId}<br/>
Is Closed {isClosed}<br/>
</template>
Complete Metadata:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>50.0</apiVersion>
<description>Lwc Close Case</description>
<isExposed>true</isExposed>
<masterLabel>Lwc Close Case</masterLabel>
<targets>
<target>lightning__RecordPage</target>
</targets>
</LightningComponentBundle>
UI Output:
Note that "Is Closed" returns no information, true or false.
I know that @wire runs asynchronously so I tried updating my template:
<template >
<template if:true={record.data}>
record.data is true
</template>
<template if:false={record.data}>
record.data is false
</template>
</template>
This returns record.data is false
in the UI and does not change.
Is there anything special I need to do to get this to run on a record page in a tab? What am I missing? I'm sure it's something simple. Thanks in advance.