Network access for Distributed Transaction Manager (MSDTC) has been disabled

I have a post-processing BPM on SalesOrder.Update that worked. Then I added this code and now I’m getting an error. The code runs when the user checks a UD field checkbox on order entry - and it still works there. But when they check the same checkbox on an updateable dashboard it triggers the error. Any ideas?

string sQueryName= "GetShipToAddress";
        var context = (Erp.ErpContext)Ice.Services.ContextFactory.CreateContext();
        using (var svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.DynamicQuerySvcContract>(context))
          Ice.Tablesets.DynamicQueryTableset dsQuery = svc.GetByID(sQueryName);
          if (dsQuery !=null)
            Ice.Tablesets.QueryExecutionTableset dsBAQ = svc.GetQueryExecutionParameters (dsQuery);
            dsBAQ.ExecutionParameter[0].ParameterID = "OrderNum";
            dsBAQ.ExecutionParameter[0].ParameterValue = OrderNum.ToString();
            DataSet results = svc.Execute(dsQuery, dsBAQ);
            if(results !=null && results.Tables.Count>0 && results.Tables[0].Rows.Count > 0 )
              DataRow srow = results.Tables[0].Rows[0];
              ShipToAddress = srow["Calculated_ShipToAddress"].ToString();

Ice.Common.EpicorServerException: BPM runtime caught an unexpected exception of ‘EntityException’ type.
See more info in the Inner Exception section of Exception Details. —> System.Data.Entity.Core.EntityException: The underlying provider failed on Open. —> System.Transactions.TransactionManagerCommunicationException: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool. —> System.Runtime.InteropServices.COMException: The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024)
at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionShim& transactionShim)
at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)

You create new context

 var context = (Erp.ErpContext)Ice.Services.ContextFactory.CreateContext();

and use it in transaction, this gives the error.
Either use the existing context or suppress transaction

How would I do that?

i think Db variable references the current context. So you should be able to just use it.

and you suppress transaction with something like this:

           using (new SuppressedTransactionScope())
                using (var dataContext =  code_to_create_context)) {
                  // do something with dataContext

I don’t know what I’m doing wrong.

You have an extra “)” at the end of the CreateContext()); line (2)

ugh, thank you. That allows it to compile but still get the same error when using the updateable dashboard.

you have it in wrong order. You need to add line with Suppress before you create context.
You added it after context creation.
Switch 2nd and 3rd line (and add using for context as a good citizen

Still getting the same error :frowning:

If this is in a BPM dont create a new context just use Db


1 Like

it is not context, it is service rendeder - reference to the service method that takes context as a parameter.

You create context on line 2
var context = … CreateContext()


Thank you for all your help!!