Error: Unable to find object in context - Iterator has probably been changed

I am working in a service where I have two runtime data sources, I will refer to them as X (cardinality-many) and Y (cardinality-one) and they are of the same object class.


I have a for loop that iterates over a data source and in each iteration, I would like to create a new object in X with properties that do not depend on the current data source that I am iterating on. However, I get the error message: Error: Unable to find object in context - Iterator has probably been changed.

Now that is strange, because that literally happens in the first iteration, and I haven’t modified the iterating data source at all.

Nevertheless, I tried a workaround solution to create an object in Y first then read it to X, but the same error message occurs again.

At this point, I’m just confused. To investigate further, I tried to create an object in Y OUTSIDE the loop and filled the properties with some hardcoded values that do not depend on any other data source - and the exact same error message appears. Note that I’m not even depending on any object in context, I’m just creating a completely new object.

As you can see from the attached image, this is the flow that I’m using now, the disabled create object was to create an object in Y and the one with the error is creating an object in X. Both result in the same error.

I checked the permissions for the object class and I already enabled Create, Read, Update, Delete.

Does this happen to be a bug?

Hi!

First off: Are you iterating the same data source Order line (runtime, many) twice (I see 2 “For each” loops)? Og just in the outer loop? And, are you setting selection on that same data source?

You cannot iterate the same datasource twice (since it will have 2 contexts inside the inner loop - not a feature we have), and if so I guess you might get errors like this. Also note when combining iterations with selection, you must be aware that object in context supercede the selected object.

This is not a direct answer, but might help to pinpoint the issue!

Nope, I’m not iterating on the Order line (runtime, many) data source; the for loops are iterating on separate data sources that are not of the object class order line. I’m just creating an object which is independent of any other data sources. In theory it should work.

@kristian Here are the screenshots of what I tried out where I tried creating an object in Order line (runtime, one).

As you can see, just creating the object at the start of the action already causes the same error

Ok, thanks. In the red error box, can you screenshot the “Show details” as well as providing a screenshot of the Create Object setup failing? Might DM if easier.

@kristian sent you a DM, thanks!