getSettings method below returns settings JSON record and when i am trying to set picklist options using productFamilyOptions variable which is used as options of the .html file, I am getting this error("ReferenceError: a is not defined at eval (eval at productFamilyOptions) in the catch section below. Can someone please help.


<lightning-combobox name="ProductFamily" label="Product Family" value={Opp.Type__c} placeholder="select product family" options={productFamilyOptions}></lightning-combobox>



import { LightningElement, track, wire} from 'lwc';
import getSettings from '@salesforce/apex/ContactsUtility.getSettings';

export default class CreateOpportunity extends LightningElement {

@track productFamilyOptions = [];

  connectedCallback() {

    getSettings() .then(result => {   
      for(let key in JSON.parse(result[0].Data__c).family){

  .catch(error => {
      this.error = error;

  • 1
    Please use the {} tool in the editor, or select + Ctrl-K, to format your code so that the community can read it.
    – David Reed
    Aug 10, 2019 at 1:48
  • Sure, thanks for letting know
    – chandu ch
    Aug 11, 2019 at 22:59

1 Answer 1


Replacing this.productFamilyOptions.push({"label":key,"value":key});
with this.productFamilyOptions = [...this.productFamilyOptions,{"label":key,"value":key}];
has resolved my issue. As per my limited knowledge on LWC, push operation doesnot work on arrays with @track. we have to use spread syntax to add elements to array instead of push

  • I'm pretty sure Push() works with @track. Jan 5, 2021 at 15:22

You must log in to answer this question.

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