uBAQ BPM Runtime Error

We have a uBAQ/Dashboard that our field service team uses to assign a selected a “Installer” to a UD field on the SO -“Install” Line (OrderDtl). The Installer is a record on in the Vendor table --aka “Supplier” in the Epicor client. They’ve asked to now have the Vendor.PhoneNum also populated onto a new UD on OrderDtl. The code seems pretty straight forward, but it’s throwing an error. I’ve not done many BASE process BPMs.

Anyone have ideas what I’m doing wrong?

Code:

foreach(var r in ttResults.Where(r=>r.Updated()))
{
	int oNum = Convert.ToInt32(r.OrderHed_OrderNum);
int oLine = Convert.ToInt32(r.OrderDtl_OrderLine);

	foreach(var order in(
        from lines in Db.OrderDtl.With(LockHint.UpdLock)
        join hed in Db.OrderHed.With(LockHint.UpdLock) on new {lines.Company, lines.OrderNum} equals new {hed.Company, hed.OrderNum} 
		where lines.Company==Session.CompanyID && lines.OrderNum==oNum && lines.OrderLine==oLine
        select new {lines, hed}))
	using(var scope = IceDataContext.CreateDefaultTransactionScope())
	{
		if(order.hed != null )
			order.hed["Character01"] = r.OrderHed_Character01.ToString();

		if(order.lines != null)
        {
//--new code            
        string vend = r.OrderDtl_FS_SupplierName_c.ToString();
        var venPhone = (from v in Db.Vendor.With(LockHint.NoLock) where v.Company == Session.CompanyID && v.Name == vend select v.PhoneNum).DefaultIfEmpty("").FirstOrDefault();
        order.lines["FS_SupplierPhone_c"] = venPhone.ToString();     
//--end new code

        order.lines ["FS_SupplierName_c"] = r.OrderDtl_FS_SupplierName_c.ToString();
        order.lines ["FS_Locked_c"] = Convert.ToBoolean(r.OrderDtl_FS_Locked_c);
        order.lines ["FS_BluePrintDate_c"] = r.OrderDtl_FS_BluePrintDate_c.ToString();
        order.lines ["FS_CorePlanDate_c"] = r.OrderDtl_FS_CorePlanDate_c.ToString();
        order.lines ["FS_ElectronicFormDate_c"] = r.OrderDtl_FS_ElectronicFormDate_c.ToString();
        order.lines ["FS_ProjFolder_c"] = r.OrderDtl_FS_ProjFolder_c.ToString();
        order.lines ["FS_Comments_c"] = r.OrderDtl_FS_Comments_c.ToString();
        order.lines ["FS_ReasonBool_c"] = Convert.ToBoolean(r.OrderDtl_FS_ReasonBool_c);
        order.lines ["FS_ReasonCode_c"] = r.OrderDtl_FS_ReasonCode_c.ToString();
			if( r.OrderDtl_Number04 != null )
				order.lines ["Number04"] = Convert.ToDecimal(r.OrderDtl_Number04);
}

scope.Complete();
	}
}````


Error:

Server Side Exception

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

Description: BPM runtime caught an unexpected exception of ‘EntityException’ type.
See more info in the Inner Exception section of Exception Details.
Inner Exception: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)
The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)
Program: EntityFramework.dll
Method: EnlistTransaction
Original Exception Type: EntityException
Framework Method: A001_CustomCodeAction
Framework Line Number: 0
Framework Column Number: 0
Framework Source: A001_CustomCodeAction at offset 4956 in file:line:column :0:0

Server Trace Stack: at System.Data.Entity.Core.EntityClient.EntityConnection.EnlistTransaction(Transaction transaction)
at System.Data.Entity.Core.Objects.ObjectContext.EnsureContextIsEnlistedInCurrentTransaction[T](Transaction currentTransaction, Func1 openConnection, T defaultValue) at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions) at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery1.<>c__DisplayClass7.<GetResults>b__5() at System.Data.Entity.Core.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) at System.Data.Entity.Core.Objects.ObjectQuery1.<System.Collections.Generic.IEnumerable.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator1.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source)
at Epicor.Customization.Bpm.Ubaq70FF3B7B4EE0416FA9B9813EEE1A15A5.UpdateBaseDirective_ISI_FS_Installations_UPDATE_ADW_9412E80B7875499AB50EF8F445136AEB.A001_CustomCodeAction()
at Epicor.Customization.Bpm.Ubaq70FF3B7B4EE0416FA9B9813EEE1A15A5.UpdateBaseDirective_ISI_FS_Installations_UPDATE_ADW_9412E80B7875499AB50EF8F445136AEB.ExecuteCore()
at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in C:_Releases\ICE\ICE3.2.200.11\Source\Server\Internal\Lib\Epicor.Customization.BPM\DirectiveBase.Generic.cs:line 147

Inner Trace:
The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)
: at System.Transactions.Oletx.OletxTransactionManager.ProxyException(COMException comException)
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.Enlist(Transaction tx)
at System.Data.SqlClient.SqlInternalConnection.EnlistTransaction(Transaction transaction)
at System.Data.SqlClient.SqlConnection.EnlistTransaction(Transaction transaction)
at Epicor.Data.Provider.EpiConnection.EnlistTransaction(Transaction transaction) in C:_Releases\ICE\ICE3.2.200.11\Source\Framework\Epicor.System\Data\EpiProvider2\EpiConnection.cs:line 208
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action2 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.EnlistTransaction(DbConnection connection, EnlistTransactionInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.EntityConnection.EnlistTransaction(Transaction transaction)

The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)
: at System.Transactions.Oletx.ITransactionShim.Export(UInt32 whereaboutsSize, Byte whereabouts, Int32& cookieIndex, UInt32& cookieSize, CoTaskMemHandle& cookieBuffer)
at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte whereabouts)

Client Stack Trace

at Epicor.ServiceModel.Channels.ImplBase1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets) at Ice.Proxy.BO.DynamicQueryImpl.Update(DynamicQueryDataSet queryDS, DataSet queryResultDataset) at Ice.Adapters.DynamicQueryAdapter.<>c__DisplayClass27_0.<Update>b__0(DataSet datasetToSend) at Ice.Adapters.DynamicQueryAdapter.ProcessUbaqMethod(String methodName, DataSet updatedDS, Func2 methodExecutor, Boolean refreshQueryResultsDataset)
at Ice.Adapters.DynamicQueryAdapter.Update(DynamicQueryDataSet queryDS, DataSet updatedDS, Boolean refreshQueryResultsDataset)
at Ice.UI.App.BAQDesignerEntry.BAQTransaction.b__378_0(Int32& rowReturned)
at Ice.UI.App.BAQDesignerEntry.Forms.BAQDiagramForm.ShowQueryResults(DataSet dsResults, getQueryResult getResults, ReportAdditionalInfo additionalInfo)
at Ice.UI.App.BAQDesignerEntry.BAQTransaction.CallUpdate()

I would start with wrapping the assignment with a null check. You may also be able to do ?. but I am still learning when those are available.

if (venPhone != null);
{
order.lines["FS_SupplierPhone_c"] = venPhone.ToString();     
}

order.lines["FS_SupplierPhone_c"] = venPhone?.ToString();     
1 Like

Couldn’t get the uBAQ BPM to work but I was able to make it with a In-Trans Data Directive on OrderDtl

string vend = "";
foreach (var ttRow  in (from row in ttOrderDtl select row))
{
  if (ttRow != null)
    {  
        vend = ttRow.FS_SupplierName_c;
        
        if (vend != null)
        {
          var venPhone = (from v in Db.Vendor.With(LockHint.NoLock)
                          where v.Company == Session.CompanyID && v.Name == vend
                          select v.PhoneNum).DefaultIfEmpty("").FirstOrDefault();

            ttRow.FS_SupplierPhone_c = venPhone.ToString();    
        }   
    }   
}

Wouldn’t this run every time the db was hit? I would check that the phone number was empty in the ttRow select.

There is a condition block in front of it that has this only fire when the SupplierName_c field is changed.

1 Like