Implicit distributed transactions have not been enabled -- ARInvoice BO from CustShip Method

Hey there,

I’ve seen another post on the subject, but no answers, so I’ll give it a shot.

I’m upgrading from E10 to 2024.1.

The situation:

In customer shipment, the (E10) screen customization creates an invoice group and an invoice for each ship detail record.

It’s quit working in 2024.1 in the classic customization. It needs to move to a BPM anyway.

But all the combinations of things I do in the BPMs give me an error like this:


BPM runtime caught an unexpected exception of 'EntityException' type.
See more info in the Inner Exception section of Exception Details.

Exception caught in: Epicor.ServiceModel

Error Detail 
============
Correlation ID:  42b036aa-1957-4d27-a074-9e48287d4ea2
Description:  BPM runtime caught an unexpected exception of 'EntityException' type.
See more info in the Inner Exception section of Exception Details.
Inner Exception:  Implicit distributed transactions have not been enabled. If you're intentionally starting a distributed transaction, set TransactionManager.ImplicitDistributedTransactions to true.
Program:  EntityFramework.dll
Method:  EnlistTransaction
Original Exception Type:  EntityException
Framework Method:  <Compile>b__3
Framework Line Number:  1585
Framework Column Number:  35
Framework Source:  <Compile>b__3 at offset 81 in file:line:column C:\_releases\ICE\ICE4.3.100.30\Source\Server\Framework\Epicor.System\Data\DBExpressionCompiler.Generated.cs:1585:35

Server Trace Stack:     at System.Data.Entity.Core.EntityClient.EntityConnection.EnlistTransaction(Transaction transaction)
   at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass41_0.<GetResults>b__0()
   at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at System.Data.Entity.Core.Objects.CompiledQuery.ExecuteQuery[TResult](ObjectContext context, Object[] parameterValues)
   at Epicor.Data.DBExpressionCompiler.<>c__DisplayClass61_1`10.<Compile>b__3(TDataContext c, Func`10 query) in C:\_releases\ICE\ICE4.3.100.30\Source\Server\Framework\Epicor.System\Data\DBExpressionCompiler.Generated.cs:line 1585
   at Epicor.Data.DBExpressionCompiler.GetResult[TDataContext,TQuery,TResult](Func`3 executeQuery, Cache cacheSetting, TDataContext dataContext, TQuery query) in C:\_releases\ICE\ICE4.3.100.30\Source\Server\Framework\Epicor.System\Data\DBExpressionCompiler.cs:line 438
   at Epicor.Data.DBExpressionCompiler.InvokeSingle[TDataContext,TQuery,TResult](Operation operation, Expression expression, Cache currentCacheSetting, Boolean cacheQuery, TDataContext dataContext, String callingMethod, Func`2 getDataCacheKey, Func`2 compileQuery, Func`3 executeQuery)
   at Epicor.Data.DBExpressionCompiler.<>c__DisplayClass61_0`10.<Compile>b__0(TDataContext dataContext, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7, TArg8 arg8)
   at Erp.Internal.PE.PELock.IsDocumentLock(String cCompany, String cSource, String cKey1, String cKey2, String cKey3, String cKey4, String cKey5, String cKey6) in C:\_releases\ERP\ERP11.3.100.0\Source\Server\Internal\PE\PELock\PELock.cs:line 118
   at Erp.Services.BO.ARInvoiceSvc.InvcHeadBeforeUpdate() in C:\_releases\ERP\ERP11.3.100.30\Source\Server\Services\BO\ARInvoice\ARInvoice.cs:line 16909
   at Ice.Services.Trace.TablesetProfilingCollector.DoRowEventTrace(String tableName, String methodName, Int32 rowCount, Action action) in C:\_releases\ICE\ICE4.3.100.30\Source\Server\Framework\Epicor.Ice\Services\TablesetProfilingCollector.cs:line 138
   at Ice.TablesetBound`3.CreateRow(IceDataContext dataContext, Int32 tableNum, IIceTable table, IceRow newTablesetRow, IReadOnlyCollection`1 writeDeniedColumns, TablesetProfilingCollector parentTraceCollector) in C:\_releases\ICE\ICE4.3.100.30\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 1099
   at Ice.TablesetBound`3.WriteTable(IceDataContext dataContext, Int32 tableIndex, IIceTable table, TablesetProfilingCollector parentTraceCollector) in C:\_releases\ICE\ICE4.3.100.30\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 958
   at Ice.TablesetBound`3.InnerUpdate[TUpdater](IceDataContext dataContext, TFullTableset tableset) in C:\_releases\ICE\ICE4.3.100.30\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 893
   at Erp.Services.BO.ARInvoiceSvc.Update(ARInvoiceTableset& ds) in C:\_releases\ERP\ERP11.3.100.30\Source\Server\Services\BO\ARInvoice\ARInvoice.Designer.cs:line 4656
   at Epicor.Customization.Bpm.BO.UpdatePreProcessingDirective_TraneTruckListInvoice_9B8BC778B16C4E80A4A6B6D81CD68E8D.C004_CustomCodeCondition()
   at Epicor.Customization.Bpm.BO.UpdatePreProcessingDirective_TraneTruckListInvoice_9B8BC778B16C4E80A4A6B6D81CD68E8D.ExecuteCore(Int32 step)
   at Epicor.Customization.Bpm.DirectiveBase`2.Execute() in C:\_releases\ICE\ICE4.3.100.0\Source\Server\Customization\Epicor.Customization.Bpm\DirectiveBase.Generic.cs:line 337
   at Epicor.Customization.Bpm.DirectiveBase`2.Execute(TParam parameters) in C:\_releases\ICE\ICE4.3.100.0\Source\Server\Customization\Epicor.Customization.Bpm\DirectiveBase.Generic.cs:line 191

Inner Trace:
Implicit distributed transactions have not been enabled. If you're intentionally starting a distributed transaction, set TransactionManager.ImplicitDistributedTransactions to true.
:   at System.Transactions.DtcProxyShim.DtcProxyShimFactory.ConnectToProxy(String nodeName, Guid resourceManagerIdentifier, Object managedIdentifier, Boolean& nodeNameMatches, Byte[]& whereabouts, ResourceManagerShim& resourceManagerShim)
   at System.Transactions.Oletx.DtcTransactionManager.Initialize()
   at System.Transactions.Oletx.DtcTransactionManager.get_ProxyShimFactory()
   at System.Transactions.Oletx.OletxTransactionManager.CreateTransaction(TransactionOptions properties)
   at System.Transactions.TransactionStatePromoted.EnterState(InternalTransaction tx)
   at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)
   at System.Transactions.Transaction.Promote()
   at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction)
   at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
   at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts)
   at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
   at System.Data.SqlClient.SqlInternalConnection.EnlistTransaction(Transaction transaction)
   at Ice.Data.Provider.EpiConnection.EnlistTransaction(Transaction transaction) in C:\_releases\ICE\ICE4.3.100.30\Source\Server\Framework\Epicor.System\Data\EntityFramework\EF6\Provider\EpiConnection.cs:line 147
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.EnlistTransaction(DbConnection connection, EnlistTransactionInterceptionContext interceptionContext)
   at System.Data.Entity.Core.EntityClient.EntityConnection.EnlistTransaction(Transaction transaction)



Client Stack Trace 
==================
   at Epicor.ServiceModel.Channels.ImplBase.CallWithCommunicationFailureRetry(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, RestRpcValueSerializer serializer)
   at Epicor.ServiceModel.Channels.ImplBase.CallWithMultistepBpmHandling(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
   at Epicor.ServiceModel.Channels.ImplBase.Call(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
   at Erp.Proxy.BO.CustShipImpl.UpdateMaster(CustShipDataSet ds, Boolean doValidateCreditHold, Boolean doCheckShipDtl, Boolean doLotValidation, Boolean doCheckOrderComplete, Boolean doPostUpdate, Boolean doCheckCompliance, Boolean ipShippedFlagChanged, Int32 ipPackNum, Int32 ipBTCustNum, String& opReleaseMessage, String& opCompleteMessage, String& opShippingMessage, String& opLotMessage, String& opInventoryMessage, String& opLockQtyMessage, String& opAllocationMessage, String& opPartListNeedsAttr, String& opLotListNeedsAttr, String& shipCreditMsg, Boolean& cError, Boolean& compError, String& msg, String& opPostUpdMessage, Boolean& updateComplete, Boolean& checkComplianceError, Boolean& changeStatusError, Boolean& checkShipDtlAgain)
   at Erp.Adapters.CustShipAdapter.UpdateMaster(Boolean doValidateCreditHold, Boolean doCheckShipDtl, Boolean doLotValidation, Boolean doCheckOrderComplete, Boolean doPostUpdate, Boolean doCheckCompliance, Boolean ipShippedFlagChanged, Int32 ipPackNum, Int32 ipBTCustNum, String& opReleaseMessage, String& opCompleteMessage, String& opShippingMessage, String& opLotMessage, String& opInventoryMessage, String& opLockQtyMessage, String& opAllocationMessage, String& opPartListNeedsAttr, String& opLotListNeedsAttr, String& shipCreditMsg, Boolean& cError, Boolean& compError, String& msg, String& opPostUpdMessage, Boolean& updateComplete, Boolean& checkComplianceError, Boolean& changeStatusError, Boolean& checkShipDtlAgain)
   at Erp.UI.App.CustShipEntry.Transaction.Update()

Inner Exception 
===============
The underlying provider failed on EnlistTransaction.

It will create the group okay, but when I hit Update() on the new invoice header I get this error.

I even tried updating a record to UD35 and tried the BPM from there, but no change.

It doesn’t mind the InvcGrp or UD35 BOs, but that ARInvoice BO bombs ever time.

I’ve not had this issue before, and I’ve done some hacky things in my past.

Any guidance, hints, remarks, well wishes?

Thanks,

Joe

1 Like

Why create invoices manually? When you can just automate the get shipments process?

1 Like

They do some different things for a particular (big) customer.

1 Like

Things that cant be done to the invoice after it is created and before its posted? Like what?

This error often happens when the actions are done within a foreach loop on Db records.

If you have a Db call that is then being iterated over
Try adding a .ToList() at the end of the Db call.

3 Likes

Thanks, Ben.

Ben,

That was it. I’ve had the issue before (been a while), but I don’t remember getting this error code.

Thanks!

Joe

1 Like

Excellent. Glad it solved it.
Generally speaking if I am going to do anything that modifies the database, even through BOs, within a foreach I try and remember to add a .ToList() the few times I forget I either get that error or something similar.

You might want to mark Ben’s recommendation as a solution, so that people immediately see what resolved the issue.

Yep, I forgot. Thanks!