REST Patch to uBAQ Failing Suddenly

So, I have this uBAQ that executes a PO receipt which has been working since probably October.
I went to play around with it today and when the REST executes it’s giving me this message: “Unexpected ‘S’”. I haven’t touched the uBAQ or the code in months. I’m not entirely sure how to diagnose that error. Does anyone have any thoughts?

Postman:

Error from VS

Probably coming from your BPM?
Can you add REST Tracing and see what it says?

If I update via the BAQ GUI, it works properly.
How do I add REST tracing and where do I view the output?

2 Likes

Then save, and run it you should see a new LogFile (ServerLog.txt) added to that same folder. (immediately)

Some of these look like numbers and you are passing them in as string (not sure if that matters in this case)

Looks like I’m getting a null reference exception from the BPM.
None of the values in the body are set as null and the info exists/runs if I do it from the BAQ UI. What gives? Lol. And why is this suddenly happening?

The string to number thing is handled elsewhere.

1 Like

Paste your BPM code

callContextBpmData.Character03 = "";

foreach(var tt in ttResults.Where(r=>r.Updated()))
{
  int pNum = (int)tt.POHeader_PONum;
  int pLine = (int)tt.PODetail_POLine;
  decimal qty = (decimal)tt.Calculated_Quantity;
  int qtyPer = (int)tt.Calculated_QtyPer;
  string warehouse = (string)tt.Calculated_Warehouse;
  string bin = (string)tt.Calculated_Bin;
  string comments = (string)tt.Calculated_CalcComment;

  try
  {
    using(var rcvBO = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ReceiptSvcContract>(Db))
    {
      ReceiptTableset rcvTS = new ReceiptTableset();
      
      //ExistsRecvHead Method
      int vendorNum = (int)tt.POHeader_VendorNum;
      string purPoint = (string)tt.POHeader_PurPoint;
      string packSlip = (string)tt.Calculated_PackSlip;
      string warning = "";

      rcvBO.ExistsRcvHead(vendorNum,
                          purPoint,
                          packSlip,
                          out warning);
   
      if( !warning.Equals(string.Format("The Packing Slip {0} already exists. Do you want to continue?",packSlip)) )
      {
        
        //GetNewRcvHead Method
        vendorNum = 0;
        purPoint = "";
        
        rcvBO.GetNewRcvHead(ref rcvTS,
                            vendorNum,
                            purPoint);
 
        //GetPOInfo Method
        bool fromReceiptEntryNewRcpt = true;
        
        rcvBO.GetPOInfo(ref rcvTS,
                        pNum,
                        fromReceiptEntryNewRcpt,
                        out vendorNum,
                        out purPoint);
   
        //GetWarningPOClosed Method
        string cWarning = "";
        
        rcvBO.GetWarningPOClosed(pNum,
                                 out cWarning);
        
        if( cWarning != "" )
          ;//Do Code
        
        //HHCanEditPackSLip
        
        //Update Method
        rcvTS.RcvHead[0].ReceiptDate = DateTime.Today;
        rcvTS.RcvHead[0].PackSlip = packSlip;
        rcvTS.RcvHead[0].ReceivePerson = Session.UserID;
        rcvTS.RcvHead[0].RowMod = "A";
        rcvBO.Update(ref rcvTS);
 
      }
      //GetNewRcvDtl Method
      rcvBO.GetNewRcvDtl(ref rcvTS,
                         vendorNum,
                         purPoint,
                         packSlip);
     
      //GetDtlPOLineInfo Method
      int packLine = 0;
      string serialWarning = "";
      
      rcvBO.GetDtlPOLineInfo(ref rcvTS,
                             vendorNum,
                             purPoint,
                             packSlip,
                             packLine,
                             pLine,
                             out serialWarning);
       
      //GetDtlQtyInfo Method
      decimal inputOurQty = qty;
      string inputIUM = (string)tt.Calculated_UOM;
      string whichField = "QTY";
      string warnMsg = "";
      
      rcvBO.GetDtlQtyInfo(ref rcvTS,
                          vendorNum,
                          purPoint,
                          packSlip,
                          packLine,
                          inputOurQty,
                          inputIUM,
                          whichField,
                          out warnMsg);
        
      if( warnMsg != "" )
        ;//Do Code
      
      //CheckDtlBeforeUpdate Method
      string qMessageStr = "";
      string sMessageStr = "";
      string lcMessageStr = "";
      string pcMessageStr = "";
      
      rcvBO.CheckDtlBeforeUpdate(rcvTS,
                                 vendorNum,
                                 purPoint,
                                 packLine,
                                 packSlip,
                                 out qMessageStr,
                                 out sMessageStr,
                                 out lcMessageStr,
                                 out pcMessageStr);

      //PreUpdate Method
      bool RequiresUserInput = false;
      
      rcvBO.PreUpdate(ref rcvTS,
                      out RequiresUserInput);
   
      //Update Method
      rcvTS.RcvDtl[rcvTS.RcvDtl.Count - 1].Received = true;
      rcvTS.RcvDtl[rcvTS.RcvDtl.Count - 1].ReceiptDate = DateTime.Today;
      rcvTS.RcvDtl[rcvTS.RcvDtl.Count - 1].POComment = comments;
      rcvTS.RcvDtl[rcvTS.RcvDtl.Count - 1].BinNum = bin;
      rcvTS.RcvDtl[rcvTS.RcvDtl.Count - 1].WareHouseCode = warehouse;
      rcvTS.RcvDtl[rcvTS.RcvDtl.Count - 1]["QtyPer_c"] = qtyPer;
      rcvTS.RcvDtl[rcvTS.RcvDtl.Count - 1].RowMod = "A";
      rcvBO.Update(ref rcvTS);
    
    }
  }
  catch(Exception e){callContextBpmData.Character03 = e.ToString();}
}

Hmmm and if you run it in POSTMAN it doens’t work either…
Any new BPMs in Receipt BO?

Also for giggles add “RowMod”:“U” to the call

POSTMAN fails with “Unexpected ‘S’: Sorry! Something went wrong. Please contact your system administrator.”

No new BPMs.
Adding the RowMod yields the same result.

can you add , true after Db above

    using(var rcvBO = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ReceiptSvcContract>(Db, true))

and try again (again for giggles)

No change.
What did that do anyways?

Bypasses FACADE (BPM/DD)

So you are already catching the exception can you paste the error you are getting on the REST Trace?

<RESTApi msg="Incoming request https://isiepicor.elkay.elkaymfgco.com/test/api/v1/BaqSvc/U-POReceipt?PONUM=163092&amp;POLINE=1" machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="Request https://isiepicor.elkay.elkaymfgco.com/test/api/v1/BaqSvc/U-POReceipt?PONUM=163092&amp;POLINE=1, Auth Header scheme Basic " machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="Principal EPICOR1" machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="Find model for odata path: BaqSvc/U-POReceipt" machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="Query maps U-POReceipt into keys , " machine="ISIEPICOR" pid="176084" tid="937" />
<ServiceCaller msg="Service type Ice.Services.Bo.DynamicQuerySvcFacade retrieved for Ice:Bo:DynamicQuery in GetServiceCallInterface" machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="Dynamic query model selected for path U-POReceipt" machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="Controller ExecuteQuery is selected." machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="Path template found ~/action/entityset" machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="OperationInvokeHelper calls GetServiceCustomAction for service Ice:BO:DynamicQuery, action UpdateByID" machine="ISIEPICOR" pid="176084" tid="937" />
<ServiceCaller msg="Service type Ice.Services.BO.DynamicQuerySvcFacade retrieved for Ice:BO:DynamicQuery in GetServiceCallInterface" machine="ISIEPICOR" pid="176084" tid="937" />
<RESTApi msg="OperationInvokeHelper calls CallCustomMethod for service Ice:BO:DynamicQuery, method UpdateByID" machine="ISIEPICOR" pid="176084" tid="937" />
<ServiceCaller msg="Service type Ice.Services.BO.DynamicQuerySvcFacade retrieved for Ice:BO:DynamicQuery in GetServiceCallInterface" machine="ISIEPICOR" pid="176084" tid="937" /><Op Utc="2019-05-23T14:31:35.7409466Z" act="" dur="54.4123" cli="" usr="" machine="ISIEPICOR" pid="176084" tid="937">
  <Sql queries="2" cacheHits="0" time="3.1573" qryTypeCount="2" />
  <BpmCustomization Source="DQ" BpMethodCode="Ice.ISI_U_POReceipt.Update" Type="UBAQ Update Processing" Duration="1">
    <BpmDirective Type="2" ID="3ee6e2ed-1ccf-43e2-becd-5f68ef0aafdc" Name="UpdateBase" VisibilityScope="2" Duration="1" />
  </BpmCustomization>
  <IceAppServer msg="System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; Ice.Common.EpicorServerException: BPM runtime caught an unexpected exception of 'NullReferenceException' type.&#xD;&#xA;See more info in the Inner Exception section of Exception Details. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.&#xD;&#xA;   at Epicor.Customization.Bpm.UbaqA717119B01384F4094F036AA13510AB5.UpdateBaseDirective_UpdateBase_3EE6E2ED1CCF43E2BECD5F68EF0AAFDC.A001_CustomCodeAction()&#xD;&#xA;   at Epicor.Customization.Bpm.UbaqA717119B01384F4094F036AA13510AB5.UpdateBaseDirective_UpdateBase_3EE6E2ED1CCF43E2BECD5F68EF0AAFDC.ExecuteCore()&#xD;&#xA;   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&#xD;&#xA;   --- End of inner exception stack trace ---&#xD;&#xA;   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 163&#xD;&#xA;   at Epicor.Customization.Bpm.MethodCustomizationBase2`3.RunDirectives(TParam parameters) in C:\_Releases\ICE\ICE3.2.200.11\Source\Server\Internal\Lib\Epicor.Customization.BPM\MethodCustomizationBase2.cs:line 170&#xD;&#xA;   at Epicor.Customization.Bpm.CustomizationBase2`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.200.11\Source\Server\Internal\Lib\Epicor.Customization.BPM\CustomizationBase2.cs:line 73&#xD;&#xA;   at Epicor.Customization.Bpm.UbaqA717119B01384F4094F036AA13510AB5.ISI_U_POReceiptSvcCustomization.Update(DynamicQueryTableset queryDS, DataSet&amp; queryResultDataset)&#xD;&#xA;   at Ice.Services.BO.DynamicQuery.Internal.Ubaq.UbaqBpmCaller.Update(DynamicQueryTableset queryDesign, DataSet&amp; queryResultDataset) in C:\_Releases\ICE\ICE3.2.200.11\Source\Server\Services\BO\DynamicQuery\Internal\Ubaq\UbaqBpmCaller.cs:line 101&#xD;&#xA;   at Ice.Services.BO.DynamicQuerySvc.UpdateByID(String queryID, DataSet queryResultDataset) in C:\_Releases\ICE\ICE3.2.200.11\Source\Server\Services\BO\DynamicQuery\DynamicQuery.cs:line 622&#xD;&#xA;   --- End of inner exception stack trace ---&#xD;&#xA;   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)&#xD;&#xA;   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)&#xD;&#xA;   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)&#xD;&#xA;   at Ice.Hosting.RestApi.OperationInvokeHelper.&lt;&gt;c__DisplayClass21_0.&lt;CallInvoker&gt;b__0(Object obj) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\ServiceCaller\OperationInvokeHelper.cs:line 281&#xD;&#xA;   at Epicor.Hosting.OperationBoundInvoker.InnerInvoke(Object instance, Func`2 func) in C:\_Releases\ICE\ICE3.2.200.11\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 59&#xD;&#xA;   at Epicor.Hosting.OperationBoundInvoker.Invoke(Object instance, Func`2 func) in C:\_Releases\ICE\ICE3.2.200.11\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 28" />
  <Exception><![CDATA[
Exception has been thrown by the target of an invocation. (TargetInvocationException)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Ice.Hosting.RestApi.OperationInvokeHelper.<>c__DisplayClass21_0.<CallInvoker>b__0(Object obj) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\ServiceCaller\OperationInvokeHelper.cs:line 281
   at Epicor.Hosting.OperationBoundInvoker.InnerInvoke(Object instance, Func`2 func) in C:\_Releases\ICE\ICE3.2.200.11\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 59
   at Epicor.Hosting.OperationBoundInvoker.Invoke(Object instance, Func`2 func) in C:\_Releases\ICE\ICE3.2.200.11\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 47
   at Ice.Hosting.RestApi.OperationInvokeHelper.CallInvoker(IceDataContext dataContext, Type svcType, MethodInfo mi, Object[] inputs, Boolean isRoot) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\ServiceCaller\OperationInvokeHelper.cs:line 280
-------- Inner exception --------->>>
BPM runtime caught an unexpected exception of 'NullReferenceException' type.
See more info in the Inner Exception section of Exception Details. (EpicorServerException)
   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 163
   at Epicor.Customization.Bpm.MethodCustomizationBase2`3.RunDirectives(TParam parameters) in C:\_Releases\ICE\ICE3.2.200.11\Source\Server\Internal\Lib\Epicor.Customization.BPM\MethodCustomizationBase2.cs:line 170
   at Epicor.Customization.Bpm.CustomizationBase2`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.200.11\Source\Server\Internal\Lib\Epicor.Customization.BPM\CustomizationBase2.cs:line 73
   at Epicor.Customization.Bpm.UbaqA717119B01384F4094F036AA13510AB5.ISI_U_POReceiptSvcCustomization.Update(DynamicQueryTableset queryDS, DataSet& queryResultDataset)
   at Ice.Services.BO.DynamicQuery.Internal.Ubaq.UbaqBpmCaller.Update(DynamicQueryTableset queryDesign, DataSet& queryResultDataset) in C:\_Releases\ICE\ICE3.2.200.11\Source\Server\Services\BO\DynamicQuery\Internal\Ubaq\UbaqBpmCaller.cs:line 101
   at Ice.Services.BO.DynamicQuerySvc.UpdateByID(String queryID, DataSet queryResultDataset) in C:\_Releases\ICE\ICE3.2.200.11\Source\Server\Services\BO\DynamicQuery\DynamicQuery.cs:line 622   at Ice.Hosting.RestApi.OperationInvokeHelper.CallInvoker(IceDataContext dataContext, Type svcType, MethodInfo mi, Object[] inputs, Boolean isRoot) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\ServiceCaller\OperationInvokeHelper.cs:line 289
   at Ice.Hosting.RestApi.OperationInvokeHelper.MakeServiceCall(IceDataContext dataContext, Type svcType, MethodInfo mi, Object[] parameters) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\ServiceCaller\OperationInvokeHelper.cs:line 245
   at Ice.Hosting.RestApi.OperationInvokeHelper.CallCustomMethod(IceDataContext dataContext, String serviceName, MethodInfo mi, List`1 callParams) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\ServiceCaller\OperationInvokeHelper.cs:line 197
   at Ice.Hosting.RestApi.OperationInvokeHelper.CallCustomMethod(String serviceName, MethodInfo mi, List`1 callParams) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\ServiceCaller\OperationInvokeHelper.cs:line 185
   at Epicor.RESTApi.DataSources.IceServiceCaller.CallCustomMethod(TypeMapping typeMapping, ContextInfo context, String methodName, Object[] paramValues, IQueryOptions options) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.RESTApi\DataSources\IceServiceCaller.cs:line 235
   at Epicor.RESTApi.ODataHelpers.v3.BaqDataSourceProvider.Patch(String queryID, ContextInfo context, EdmCollectionType collectionType, IQueryOptions queryOptions, IEdmEntityObject patch, DataSet baqResultDataset) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.RESTApi\ODataHelpers\v3\BaqDataSourceProvider.cs:line 209
   at Epicor.RESTApi.Controllers.ExecuteQueryController.UpdateQuery(IEdmEntityObject patch) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.RESTApi\Controllers\ExecuteQueryController.cs:line 103
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<Sen
dAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()
-------- Inner exception --------->>>
Object reference not set to an instance of an object. (NullReferenceException)
   at Epicor.Customization.Bpm.UbaqA717119B01384F4094F036AA13510AB5.UpdateBaseDirective_UpdateBase_3EE6E2ED1CCF43E2BECD5F68EF0AAFDC.A001_CustomCodeAction()
   at Epicor.Customization.Bpm.UbaqA717119B01384F4094F036AA13510AB5.UpdateBaseDirective_UpdateBase_3EE6E2ED1CCF43E2BECD5F68EF0AAFDC.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
]]></Exception>

So you are catching any exception AFTER the intial assignment. So just for shits and gigles again move the try to right after the foreach
image

Cause that probably means the exception is in our casting. I’m wondering specifically about the decimal parsing.
I’m curious if that’ll make the Exception go away.

Same error.

Only thing that jumps out at me is

NullReferenceException
Object reference not set to an instance of an object. (NullReferenceException)

Usually when an attempt is made to use a value thats not assigned. So I would just put a bunch of Logs in the BPM and see what the values are

Ice.Diagnostics.Log.WriteEntry("pNum: " + tt.POHeader_PONum.ToString()); //etc

That doesn’t make any sense… You are catching all exceptions … the issue must be outside.
Again for shits and gigles. Disable the BPM (Un-Enable) (Save)
Re-Enable (Save)

Also do you have multiple BPMs in this thing? Or just the above code?