1697
Views
7
Comments
Cannot read property of undefined (reading list)
Question
Application Type
Reactive

Hi Community,

I'm working on a reactive web application where there is a dropdown, I'm using for fetching list of records. But while page loading, I'm getting this error.  

It is supposed to load the list with records while page load. But the data is empty. 

Hope you understand the issue. Any help will be appreciated. 

Thanks 

Prince

2021-09-21 09-26-31
Aadhavan Shanmugam

Hi @Prince K

Kindly attach oml file to understand the issue better and investigate.

Refer if required  https://www.outsystems.com/forums/discussion/74155/cannot-read-properties-of-undefined-reading-then/


Thanks, Aadhavan S

2026-04-23 05-29-20
Prince Kumar

Thanks for the reply. AS

Sorry But I can't attach the OML file. 

2021-09-21 09-26-31
Aadhavan Shanmugam

Fine Prince. I think there is an exception while initializing the object.

As per OS best practice, try to fix all the warnings of the screen. hope this will fix your issue.

Thanks, Aadhavan S

UserImage.jpg
vikas sharma
Champion

This error clearly tells that some is not initlize on screen loading. So you need to check variable which is not getting define properly. From above screen shot its not clear that its issue of dropdown or list. So you need to check it with some static values or try to initlize at some other place for a try like in oninitlize() onReady() etc.

If you can share oml for this screen only then also it will be helpful to troubleshoot this issue.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Why is this marked as solution? @Prince K did this actually solve your problem, was there indeed logic in OnInitialize or OnReady causing the errors?

2023-03-16 16-29-51
Paulo Rosário

Hello Prince, 

The error is quite clear, it means that the application wants to display something that is not yet available. 

One solution can be to wrap the dropdown in an IF statement with the IsDataFetched property of your aggregate, in this scenario the dropdown should only appear once the data is fetched.

Hope it helps!

Paulo Rosário

UserImage.jpg
steve jonn

In JavaScript, nearly everything is an object except for null and undefined. The error "Cannot read property of undefined" occurs when a property is read or a function is called on an undefined variable. Undefined indicates that a variable has been declared but not assigned a value. In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or property on such a variable causes the TypeError: Cannot read property of undefined.

To prevent errors caused by variables that may not have a guaranteed value, it is recommended to verify their value for null or undefined before utilizing them. To ensure that the variables being accessed contain the expected value, there are several approaches that can be employed. One such approach is to perform if checks prior to working with objects that may undergo changes:

if (myVar !== undefined) {

    ...

}

Or

if (typeof(myVar) !== 'undefined') {

    ...

}



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.