I have created LWC where i need to display task field 'ASSIGNED TO' in text format. but I am getting error as "Unsupported reference Task.Owner.Name of type sobjectField in file partnerTaskRecordReadForm.js"
.html :
<template>
<lightning-card>
<!-- Opportunity -->
<!-- Display -->
<template if:true={TaskRecord}>
<lightning-record-form
record-id={TaskRecord}
object-api-name={taskObject}
>
<!-- Messages -->
<lightning-messages></lightning-messages>
<div class="slds-p-bottom_large slds-p-left_large">
<br/>
<!-- Fields -->
<lightning-accordion active-section-name="A">
<lightning-accordion-section name="A" label="Task Details">
<div class="slds-grid" style="color:rgb(15, 15, 15); font-size:13px">
<div class="slds-col slds-size_1-of-2">
<div class="formfield slds-list_horizontal slds-border_bottom">
<label>Assigned To</label>
<div class="a11">{ownerName}</div>
</div>
</div>
</div>
</lightning-accordion-section>
</lightning-accordion>
</div>
<br/>
</lightning-record-form>
</template>
</lightning-card>
.js file:
import { LightningElement, api, wire} from 'lwc';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import Task_OBJECT from '@salesforce/schema/Task';
import Task_Assigned_To from '@salesforce/schema/Task.Owner.Name';
const fields = [Task_Assigned_To];
export default class partnerTaskRecordReadForm extends LightningElement
{
@api TaskRecord;
@api recordId;
taskObject = Task_OBJECT;
@wire(getRecord, { recordId: '$TaskRecord', fields})
Task;
get ownerName()
{
return getFieldValue(this.Task.data, Task_Assigned_To);
}
}
It did work for opportunity, but not working for task. Can any one please suggest how to achieve this?