Reactive Web: Error Adding Item To Table List

I have a web block that has a Table sourced with the return list of a Data Action. The user is able to enter information to add to the list. In the OnClick action for my "Add" button, the source list is appended with the information from the user. Instead of the Table updating with the newly added record, I am receiving the following error:


"Widget iteration contexts are immutable: unable to register the start of a new iteration"


I cannot find any reference to this error and the ServiceCenter error log isn't much help, even on Full logging. When I debug the block and step through the AddOnClick, the entire flow completes as I would expect. The flow goes all the way to the End and as soon as I step past End, the OnException handler throws the error.


Can anyone help me pinpoint what exactly the error is telling me? I have this module set up exactly like a few others in our application with the same flow methodology and none of them receive this error. I have even tried to decouple the Table from the Data Action and use a local variable instead; the same error occurs. 

Hi Joseph, thanks for reaching our to us.

I've tried a scenario like the one you described and did not get that error. Can you please report that through Service Studio? (in Help -> Give Us Feedback) for us to take a better look and see if there could be something going on?

Hi Joseph Robinson,

I got the scenario but if you upload the OML file then it will be possible to solve the issues. 

Waiting for your response,

Thank you,

Sudip

Hi Joseph,


can you  upload oml or images so it will helpfull to find problem .

Regards 

Rahul Sahu

Attached is the oml for the module. 


I should have also pointed out that this block did work at one point. There have been some fundamental changes since the last time I know it worked, but those changes weren't related to the table/data action.


Also, here are some screenshots. The first one is what the block looks like as soon as you enter. In this case, I am wanting to add 1 Mouse to the list. The second screenshot is what occurs after clicking the Add button (notice the Table disappears entirely)

Joseph Robinson wrote:

Attached is the oml for the module. 


I should have also pointed out that this block did work at one point. There have been some fundamental changes since the last time I know it worked, but those changes weren't related to the table/data action.


Also, here are some screenshots. The first one is what the block looks like as soon as you enter. In this case, I am wanting to add 1 Mouse to the list. The second screenshot is what occurs after clicking the Add button (notice the Table disappears entirely)

Hi Robinson.


Using the logic you have implemented i think you need to put a navigation do the end of createOnClick action likewise you have in Close button and on DeleteOnClick.


Because when you add a record, your List must be warned that something has changed, and using your logic the fastest way is with destination. The better way was to trigger events and has an handler to change the showDetail (and turn it in local variable) and use the list OnParametersChange.


Hope it was helpfull.


Thank you for the reply Miguel. I understand the change in the createOnClick action. Unfortunately, that doesn't fix the problem, though. The issue exists in AddOnClick, which I can't redirect from. For a new order, any number of products can be added via "Add", but they will not persist to the database until the "Create" button is clicked. 


I did try the suggestion in AddOnClick anyway, and as expected, that did not solve the issue. I still receive the Widget error at the end of the flow.


I ended up recreating the module from scratch thinking that maybe something potentially got corrupt in the module, but even the new module has the same issue. I'm obviously doing something wrong, but I've yet to pinpoint it. Since a Google search and Forum search returned no relative results on this error, I'll be sure to post back when I find the solution, if someone else doesn't find the solution first.


Miguel - On a slightly off-topic note, would you mind explaining the better way, or perhaps point me to documentation detailing it? I am extremely new to the OS platform so I'm learning as I go. I'm always eager to learn the best practices.

Solution

I tracked the issue down to the red "Remove" button at the right side of the row. At first I thought it was the button itself as I was able to create a Text widget with a link to the RemoveOnClick action. However, as I then started adding my customization to the Text widget, I started getting the error again! Digging deeper, I isolated the cause as the logic I had placed in the 'Enabled' property. That code was as follows:

'Enabled'

If((IntegerToBoolean(LongIntegerToInteger(id)) and CheckPermission("orders_delete")) or (id=0 and CheckPermission("orders_create")), True, False)


This specific logic hasn't changed in quite some time, but the CheckPermission() action has (it's an inherited action from another module). There is a lot to that action as it deals with some jwt tokens, OS groups, and external db permissions so it's possible some change in there is the true culprit. 

I was able to circumvent the error, however, by adding a local variable to the block and setting it in OnInitalize using the above code. Then I assigned the button Enable property to the local variable. This was probably the proper move in the first place for this scenario since the Enable property won't be different on a record level, but I could also see some future scenarios where the specific row button would be enabled/visible based on row-level data. I'll cross that bridge when it gets here, though.


This was a fun one to debug and solve. I still wish I had more insight on exactly what the root cause was, but perhaps I will investigate that at a future time.

Solution

Happy to see that your issue is solved. Please mark your solution as a "Solution". So the post can help other people who are facing same kind of issues.

Thank you,

Sudip