I have below script in .js file.
@wire(getRecord, { recordId: '$recordId', fields: FIELDS })
wiredSandAnalysis({ error, data }) {
if (data) {
this.yValues = [];
data.fields.forEach(field => { // here I am getting the error.
this.yValues.push(field.value);
});
} else if (error) {
this.error = error;
}
I can see in debug logs that records are successfully returned by Apex method. But I am getting below error.
aura_prod.map.js:42142 TypeError: b.fields.forEach is not a function
at wiredAccount (chartWrapper.js:4)
at t.dispatchEvent (aura_prod.js:13)
at Object.next (lds.js:2)
at fa.next (lds.js:2)
at Ca._nextWithErrorHandling (lds.js:2)
at eval (lds.js:2)
at Set.forEach (<anonymous>)
at Ca.emitValue (lds.js:2)
at eval (lds.js:2)
at Ta.eval [as next] (lds.js:2)
Upon logging the result in the console I found that the fields are placed into originalTarget
. but it should be in data.fields
.
Am I missing something?