Cannot read property 'map' of undefined

If you see the error “Cannot read property ‘map’ of undefined”, it implies you are trying to map to a empty array or set of values.

Typically, the javascript code within the calculator will appear as below:

inputRecord.ArrayList.map(item => ({

  • key: item.ArrayKey,*
  • value: item.ArrayValue*
    })),

Making use of Javascript Truthy logic, you can handle an empty (null) array as below:

(inputRecord.ArrayList||[]).map(item => ({

  • key: item.ArrayKey,*
  • value: item.ArrayValue*
    })),