The primary goal of this BPM was to loop through each Customer record and UD11 record while updating UD11.Number12 with the Customer.CustNum. After creating the BPM and running it, I kept getting an error that spoke about "though the transaction was completed, it wasn't properly disposed" (sorry i don't remember the exact error). After digging around the intertubes, I found this was most likely due to the Transaction timing out. So I tested the BPM a few more times and found my error happened at exactly 5 minutes each time. To get around this, I tweaked my BPM to do 500 CustNums at a time (you'll see in the code below I accomplished this with the Customer_Row.CustNum >= ## && <= ##).
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
foreach (var Customer_iterator in (from Customer_Row in Db.Customer where Customer_Row.CustNum >= 0 && Customer_Row.CustNum <= 500 select Customer_Row))
{
Customer = Customer_iterator;
foreach (var UD11_iterator in (from UD11_Row in Db.UD11.With(LockHint.UpdLock)
where Customer.Company == UD11_Row.Company && Customer.CustID == UD11_Row.Character01
select UD11_Row))
{
UD11 = UD11_iterator;
UD11.Number12 = Customer.CustNum;
Db.Validate();
}
}
txScope.Complete();
}
This would have been much simpler if I could just change the TimeOut of the TransactionScope. I found this can be achieved by:
using (TransactionScope txScope = new
TransactionScope(TransactionScopeOption.Required, new TimeSpan(0,10, 0)))
{
Code stuff here…
txScope.Complete();
}
The block of code above changes the TimeOut of the transaction to 10 minutes, but I simply could not get the code to work in Epicor. From this, I assume you must use the IceContext assembly to manipulate TransactionScope Options. So my question is: has anyone been able to increase the TimeSpan for a transaction in a BPM?
Thanks for your input. Again, I was able to get what I needed, but I was hoping someone out there has found a way to manipulate the TimeOut length for a Transaction executed by a BPM.