Calling Function from BPM, The transaction has been aborted

This is more of a warning for others since I just ran into this error and it was an odd fix.
I have a BPM that queries out child data from another table, loops through and calls a function for each child to write a row in a UD table. I was getting a “The transaction has aborted.” error.
It turns out, the cause of the error was a query that was holding the transaction scope open. Once I closed it, it started to work.
Open - var whseBins = Db.WhseBin.Where(x => x.WarehouseCode == warehse.WarehouseCode);
Closed - var whseBins = Db.WhseBin.Where(x => x.WarehouseCode == warehse.WarehouseCode).ToList();

Yep. Always add ToList() to any Db call that returns multiple records. :wink: