This is either a bug, or I’m missing something fundamental.
We have a process where a row is selected from a datatable. That row (system.data.datarow) is sent as an in argument to an invoked workflow. Within that invoked sequence a particular column value is potentially edited before the datarow is sent further into the process.
Once the transaction is done the process exits the invoked sequences (back to “main”) where a new transaction is picked up (a modified version of the REF framework). The datatable (with scope in main) has now been edited, the value of the row and column that was edited within the scope of the invoked workflow has somehow made its way into the main datatable.
Depending on the characteristics of the transaction a new row from the datatable is assigned to the datarow variable. If the same row from the datatable gets selected the modified value of the edited column follows along, and causes major issues. We had this error in production for a while before it was discovered.
Please advice - bug? How to fix (beyond reading a fresh datatable with read range for each transaction)? If not a bug, how can an edited datarow variable in a different scope that main datatable affect the main datatable?
Please find attached workflow where the bug is reproduced.
Now comes a screenshot from the second iteration, when the same row from the datatable is assigned to the datarow variable - only now, the value in the colum that was edited for the datarow has somehow carried over to the DATATABLE.
Within the invoked workflow the only variable is the row_in_variabler. Once the workflow exits, and the datatable is once again within the scope, the datatable has been modified.
It seems normal behavior. DataRow is reference type variable and has information for parent DataTable, and if you update the datarow, it reflect the DataTable even if ArgumentType is In.
I guess I was missing something fundamental then! Thank you for clearing that up, never occured to be that the datarow referenced the datatable in that manner.
I also tried to modify so that the datarow is selected from a temp datatable that is assigned fresh for each iteration from the main datatable - but the main datatable is still changed by modifications to the datarow variable… Still find this weird But, now that I know how it works I can work around it!