I am encountering the following error in Salesforce Lightning page wherein I try to render some fields based on values of multi-select picklist field:

enter image description here

I even tried includes but same error occurs. Would really appreciate any help or suggestions about this one.

Meanwhile, following are the current codes I have:


    <div class="slds-theme_default">  
        <lightning-record-edit-form object-api-name="Contact" record-id={recordId} onsuccess={handleSuccess}>
                    <lightning-input-field field-name="MultiSelectPicklist__c"
                <div if:true={renderField1}>    
                    <lightning-input-field field-name="Field1__c">
                <div if:true={renderField2}>    
                    <lightning-input-field field-name="Field2__c">


import { LightningElement, track, api, wire } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import MULTIPICKLIST_FIELD from '@salesforce/schema/Contact.MultiSelectPicklist__c';

const fields = [MULTIPICKLIST_FIELD];

export default class EditFSCalculationToolLWC extends NavigationMixin(LightningElement) {
    @api recordId;
    @track renderField1;
    @track renderField2;

    @wire(getRecord, { recordId: '$recordId', fields })

    get renderField1() {
        return getFieldValue(this.contact.data.includes('ValueA'), MULTIPICKLIST_FIELD) ? true : false; 

    get renderField2() {
        return getFieldValue(this.contact.data.includes('ValueB'), MULTIPICKLIST_FIELD) ? true : false; 

    handleMultiSelectPicklistChange(event) {
        this.contact.MultiSelectPicklist__c = event.detail.value;
    handleSuccess( event ) { 
        //some code....


1 Answer 1


You are trying to access data from contact. Yoi are getting the error because of the way you are trying to access the data.

The contact.data is null by default as the value is not yet provisioned by wire service. In addition to that, the correct way to access data inside the getter would be.

return this.contact.data &&  getFieldValue(this.contact.data,MULTISELECT_PICKLIST).includes('ValueB');
  • I modified the condition statement and followed yours, it works now! Thanks for your help :))
    – Ertyq
    Oct 20, 2020 at 3:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .