Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

What to do in this case - cannot read property split of undefined?

Asked by Elonjigar Mar 2, 2023 1.0K views 1 answer
Share

About this question

 I have the following LWC, when I try to add on my lightning record page I get some error like, cannot read property of split.

js:
import { LightningElement, api, track } from 'lwc';
    export default class CustomRecordDetail extends LightningElement {
     @track fieldArray;
        connectedCallback()
         {
            if(this.fields !== null && typeof this.fields !== undefined && this.fields !== '')
            {
                this.fieldArray = this.fields.split(",");
            }
    }
    }
html :