Data inside a List is getting reset

Hi All,

i have encountered the below issue while developing an web application, appreciate any pointers to resolve the same Thanks.

Issue:

On Notify action from web block on the web page i am populating an list variable defined at the page level with an record with valid values.

Now when we click on submit the list size is as expected, however other than the id attribute of record all other values are getting set to null values.

Why is this happeninig? how to prevent the same?

PS: there is no Ajax refresh or any other activity after end of Notify and before start of submit.

Hi Ashwathram,

Not knowing exactly how is defined your code, we will be able only to guess.

You probably are inspecting the code with the Debugger, right?
The code will be always optimized (even when debugging), so, in general, the platform will create code and keep values only for things that are being used.

If you have only the ID in the records, and other values are null, this is probably due to the platform identifying that you are not really "using" the other values and it is optimizing the code to avoid keeping values in the ViewState that you don't need.

So, if you start using those values, the platform will start keeping them.

There are other possibilities, but this one is the most probable cause for the behaviour you are seeing.

If it is not the case, please, provide more information (screenshots, pieces of code, etc).

Cheers.


Eduardo Jauch wrote:

Hi Ashwathram,

Not knowing exactly how is defined your code, we will be able only to guess.

You probably are inspecting the code with the Debugger, right?
The code will be always optimized (even when debugging), so, in general, the platform will create code and keep values only for things that are being used.

If you have only the ID in the records, and other values are null, this is probably due to the platform identifying that you are not really "using" the other values and it is optimizing the code to avoid keeping values in the ViewState that you don't need.

So, if you start using those values, the platform will start keeping them.

There are other possibilities, but this one is the most probable cause for the behaviour you are seeing.

If it is not the case, please, provide more information (screenshots, pieces of code, etc).

Cheers.


Hi Eduardo,

i am using this list to iterate and save the records. below are screenshots where this variable is used. Appreciate your help on any suggestion under which the variable list gets added to view state.

Submit Action


Web block action

Hi,

Could you provide a minimum working module that reproduces the problem?
Doesn't have to be the one you are working on, just an example (without dependencies) that reproduces the problem.

It would help a lot for us to understand the problem and find a solution.

Cheers.