SubmitToAgent issue

I’m running into an issue and am unsure of what to do to fix it. I think I know what’s happening, but I wanted to check to make sure.

We have a BPM that’s triggered off of an update to a SysAgentSched task. Within this task, we are producing a report. The code in 10.2.400 works fine. In our UAT for 2022.2 we’re getting this error:

This platform does not support distributed transactions.

And the code:

using (var srvSOPL  = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SOPickListReportSvcContract>(Db))
{
  var ts = srvSOPL.GetNewParameters();
  srvSOPL.GetDefaults(ref ts);

  // set parameters
  ts.SOPickListReportParam[0].FromDate = ...
  ...
  srvSOPL.SubmitToAgent(ts,"SystemTaskAgent",0,0,"Erp.UIRpt.SOPickListReport");
}

We’re only creating the service object and submitting it with the parameters needed to run the report.

Is there something in Kinetic that prevents you from Submitting a job to the agent in a BPM for the SysAgentSched?

Do you have any transaction scopes in this BPM, or is this pretty much it?

This is it. The only thing we do is create a temporary session to the Company/Plant. I don’t know if that effects anything or not.

Try wrapping it in a transaction scope.

I’ve found that in newer versions of ERP/Kinetic, I am needing to use TransactionScopes where I have not had to in the past. If you are using Functions, it is as simple as checking the ‘Transaction’ checkbox.

4 Likes

thanks for the tip andrew!

Tried, same issue.

I have other BPMs that work just fine with other services. It just seems to be the SubmitToAgent.

It’s weird. We’re not doing any updates to anything, just trying to fire off the process. I’ve done everything I can think of to handle this. I looked through other BPMs that we have, and we do have several that are firing off tasks by submitting to the agent. I’m not sure why it is just this one is not working.

I may redo it from scratch to see if that sheds any light on it.

Hmmmm,

Take this same code, and fire it from somewhere else. If it works, we know it’s something
funky with where you are trying to launch it from.

1 Like

Well, I moved it to a Function, scheduled the function and got the exact same error.
image

Exception executing library 'prcScheduledProcesses' function 'DistributorPickListBatchPrinting':
System.Data.Entity.Core.EntityException: The underlying provider failed on EnlistTransaction.
 ---> System.PlatformNotSupportedException: This platform does not support distributed transactions.
   at System.Transactions.Distributed.DistributedTransactionManager.GetDistributedTransactionFromTransmitterPropagationToken(Byte[] propagationToken)
   at System.Transactions.TransactionInterop.GetDistributedTransactionFromTransmitterPropagationToken(Byte[] propagationToken)
   at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx)
   at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx)
   at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)
   at System.Transactions.Transaction.Promote()
   at System.Transactions.TransactionInterop.ConvertToDistributedTransaction(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 System.Data.SqlClient.SqlConnection.EnlistTransaction(Transaction transaction)
   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)
   --- End of inner exception stack trace ---
   at System.Data.Entity.Core.EntityClient.EntityConnection.EnlistTransaction(Transaction transaction)
   at System.Data.Entity.Core.Objects.ObjectContext.EnsureContextIsEnlistedInCurrentTransaction[T](Transaction currentTransaction, Func`1 openConnection, T defaultValue)
   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.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__31_0()
   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.GetResult[TDataContext,TQuery,TResult](Func`3 executeQuery, Cache cacheSetting, TDataContext dataContext, TQuery query) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Framework\Epicor.System\Data\DBExpressionCompiler.cs:line 446
   at Epicor.Data.DBExpressionCompiler.InvokeSingle[TDataContext,TQuery,TResult](Expression expression, Cache currentCacheSetting, Boolean cacheQuery, TDataContext dataContext, Func`2 getDataCacheKey, Func`2 compileQuery, Func`3 executeQuery) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Framework\Epicor.System\Data\DBExpressionCompiler.cs:line 307
   at Epicor.Data.DBExpressionCompiler.<>c__DisplayClass56_0`4.<Compile>b__0(TContext context, TArg1 arg1, TArg2 arg2) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Framework\Epicor.System\Data\DBExpressionCompiler.Generated.cs:line 0
   at Ice.Tables.ReportStyle.FindFirstByPrimaryKey(IceContext dataContext, String ReportID, Int32 StyleNum) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Db\Ice.Data.Model\IceContext.Model.cs:line 136654
   at Ice.Core.RptServiceBase`1.UpdateParam(IceRow paramRow) in C:\_releases\ICE\ICE4.2.200.9\Source\Server\Internal\Lib\TaskLib\RptBase\RptServiceBase.cs:line 68
   at Ice.Core.TaskServiceBase`1.SubmitUsingTaskAgent(IceRow parameterRow, String agentID, Int64 agentSchedNum, Int32 agentTaskNum, String maintProgram) in C:\_releases\ICE\ICE4.2.200.9\Source\Server\Internal\Lib\TaskLib\TaskBase\TaskServiceBase.cs:line 210
   at Ice.Core.TaskServiceBase`1.SubmitToAgent(IceRow parameterRow, Int64 agentSchedNum, Int32 agentTaskNum, String maintProgram, String agentID) in C:\_releases\ICE\ICE4.2.200.9\Source\Server\Internal\Lib\TaskLib\TaskBase\TaskServiceBase.cs:line 174
   at Ice.Core.TaskServiceBase`1.InnerSubmitToAgent(IceRow parameterRow, String agentID, Int64 agentSchedNum, Int32 agentTaskNum, String maintProgram) in C:\_releases\ICE\ICE4.2.200.9\Source\Server\Internal\Lib\TaskLib\TaskBase\TaskServiceBase.cs:line 142
   at Erp.Services.Rpt.SOPickListReportSvc.SubmitToAgent(SOPickListReportTableset ds, String agentID, Int64 agentSchedNum, Int32 agentTaskNum, String maintProgram) in C:\_releases\ERP\ERP11.2.200.0\Source\Server\Services\Rpt\SOPickListReport\SOPickListReport.Designer.cs:line 116
   at Erp.Services.Rpt.SOPickListReportSvcFacade.SubmitToAgent(SOPickListReportTableset ds, String agentID, Int64 agentSchedNum, Int32 agentTaskNum, String maintProgram) in C:\_releases\ERP\ERP11.2.200.0\Source\Server\Services\Rpt\SOPickListReport\SOPickListReportSvcFacade.cs:line 212
   at EFx.prcScheduledProcesses.Implementation.DistributorPickListBatchPrintingImpl.<A005_InvokeBOMethodAction2>b__15_0(SOPickListReportSvcContract bo)
   at Epicor.Functions.FunctionBase`3.CallService[TService](Action`1 action) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Internal\Lib\Epicor.Functions.Core\FunctionBase.Plugins.cs:line 63
   at EFx.prcScheduledProcesses.Implementation.DistributorPickListBatchPrintingImpl.A005_InvokeBOMethodAction2()
   at EFx.prcScheduledProcesses.Implementation.DistributorPickListBatchPrintingImpl.RunStep(Int32 workflowStep)
   at Epicor.Functions.FunctionBase`3.Run() in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Internal\Lib\Epicor.Functions.Core\FunctionBase.cs:line 92
   at Epicor.Functions.FunctionBase`3.Run(TInput input) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Internal\Lib\Epicor.Functions.Core\FunctionBase.cs:line 79
   at EFx.prcScheduledProcesses.Implementation.DistributorPickListBatchPrintingImpl.AdapterRun(Object[] input)
   at Epicor.Functions.TransactionalAdapter.Run(Object[] input) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Internal\Lib\Epicor.Functions.Core\TransactionalAdapter.cs:line 36
   at Ice.Internal.Task.ScheduledFunction.ExecuteFunction.RunFunction(IFunctionAdapter functionAdapter, Object[] parameters) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Internal\Task\ScheduledFunction\ExecuteFunction.cs:line 128
   at Ice.Internal.Task.ScheduledFunction.ExecuteFunction.RunProcess(Int64 instanceTaskNum, String outputFileName) in C:\_releases\ICE\ICE4.2.200.0\Source\Server\Internal\Task\ScheduledFunction\ExecuteFunction.cs:line 57

Hmmm, I did this and it worked:

image

1 Like

So I think now we know what happened with the other.

That BPM (SysAgentSched.Update?) method must be inside a transaction already, and causing issues.

:thinking:

1 Like

Yes, but it works in 10.2.400 … so something there must have changed.

Well, that’s what UAT is for, and I want to move these SysAgentSched BPMs to Scheduled Functions anyway…

3 Likes

Was that former BPM a post processing ?

Resurrecting an old thread as I just ran into this and wanted to add to it for future searches and to see if there was any new information.
I have a BPM triggered after MRP to run auto firm and auto release for a subset of parts and have started to receive “this platform does not support distributed transactions” after upgrading from 10.2 to 11.2.

As an alternative to calling a function, I found that changing the code from Asynchronous to Synchronous allows it to work the same as it did in 10.2 without error. I assume that the entire BPM process is running in it’s own thread already so keeping my code sync shouldn’t make any difference if it’s the last step in the BPM.

1 Like