HI all, i have an interesting issue and was wonder...
# suitescript
g
HI all, i have an interesting issue and was wondering if anyone has run into this.
Copy code
for (var k = 0; k < systemData.length; k++) {
                           
                            Object.entries(systemData[k]).forEach(([key, val]) => {
           
                                        log.debug(key,val);
                          
                            });
                        }
I get an the following error message when i run this code in my script “TypeError: Cannot read property ‘entries’ of undefined”. I am using SuiteScript 2.1 The issue is that when i run this same piece of code using the NetSuite debugger, it runs with no issue and al values are populated
r
Your data in systemData[k] might be a string instead of an object. Try doing JSON.parse() first. Or provide a bit more info if this doesn't work.
g
But the code Works in the debugger with no changes. I am already parsing the data from the integration. This is in sandbox
c
Are there role differences between the context in which you run the debugger and the context in which this code is executed when it errors?
g
No i am using administrator role on both i will test in production later today to see if i get the same error .i am using Object.keys for now as a workaround , O]bject.entries was just cleaner to write
I found my issue unrelated line item of code that was not defined. This function does work. Thanks for all your help
🙌 1