BPM Error - Requisition Update Method

Folks,

I’m creating a UBAQ to approve or reject requisitions using an updateable dashboard. Using advanced BPM Update, on Update (Base processing) in custom code I call getbyid change 5 fields and call update. I receive following error during testing…

System.ArgumentNullException: Value cannot be null.
Parameter name: fromItem
at Epicor.Data.BufferCompare.Compare[TTypeFrom,TTypeTo](TTypeFrom fromItem, TTypeTo toItem, List1 usingList, List1 exceptForList, List1 resultsList) in C:\_releases\ICE\ICE4.1.200.3\Source\Shared\Framework\Epicor.ServiceModel\Data\BufferCompare.cs:line 265 at Erp.Services.BO.ReqSvc.ReqHeadBeforeUpdate() in C:\_releases\ERP\ERP11.1.200.0\Source\Server\Services\BO\Req\Req.cs:line 2081 at Ice.Services.Trace.TablesetProfilingCollector.DoRowEventTrace(String tableName, String methodName, Int32 rowCount, Action action) in C:\_releases\ICE\ICE4.1.200.0\Source\Server\Framework\Epicor.Ice\Services\TablesetProfilingCollector.cs:line 140 at Ice.TablesetBound3.UpdateRow(IceDataContext dataContext, Int32 tableNum, IIceTable table, IceRow updatedRow, IceRow originalRow, IColumnUncensor uncensor, TablesetProfilingCollector parentTraceCollector) in C:_releases\ICE\ICE4.1.200.0\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 1282
at Ice.TablesetBound3.WriteTable(IceDataContext dataContext, Int32 tableIndex, IIceTable table, TablesetProfilingCollector parentTraceCollector) in C:\_releases\ICE\ICE4.1.200.0\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 979 at Ice.TablesetBound3.InnerUpdate[TUpdater](IceDataContext dataContext, TFullTableset tableset) in C:_releases\ICE\ICE4.1.200.0\Source\Server\Framework\Epicor.Ice\Services\TablesetBound.cs:line 871
at Erp.Services.BO.ReqSvc.Update(ReqTableset& ds) in C:_releases\ERP\ERP11.1.200.0\Source\Server\Services\BO\Req\Req.Designer.cs:line 1559
at Epicor.Customization.Bpm.MethodCustomizationBase22.RunDirectives(TParam parameters) in C:\_releases\ICE\ICE4.1.200.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\MethodCustomizationBase2.cs:line 179 at Epicor.Customization.Bpm.CustomizationBase22.Execute(TParam parameters) in C:_releases\ICE\ICE4.1.200.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\CustomizationBase2.cs:line 87
at Epicor.Customization.Bpm.BO.ReqSvcCustomization.Update(ReqTableset& ds)
at Erp.Services.BO.ReqSvcFacade.Update(ReqTableset& ds) in C:_releases\ERP\ERP11.1.200.0\Source\Server\Services\BO\Req\ReqSvcFacade.cs:line 1752
at Epicor.Customization.Bpm.Ubaq.UpdateBaseDirective_UBAQ_Approve_Reject_Req_6C047FF514B94EADBC25A6389AC2F900.A001_CustomCodeAction()…

Here a snippet of my code…

using (var ReqBO = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ReqSvcContract>(Db))
     {
       if(Response == "Approve")
       {
        var ts = ReqBO.GetByID(ReqNum);

          ts.ReqHead[0].NextActionDesc = "Approve"; 
          ts.ReqHead[0].NextActionID   = "002"; 
          ts.ReqHead[0].ReplyOption    = "A"; 
          ts.ReqHead[0].ReqUserId      = callContextClient.CurrentUserId; 
          //ts.ReqHead[0].UD_SysRevID     = "";
          ts.ReqHead[0].RowMod         = "U";  
           
          ReqBO.Update(ref ts);
       }
     }

I think you need to copy the row using buffer copy so that your data set has an unchanged row (the original with no row mod) and the updated row.

You need to create a new row then do this to copy it. Then make your changes to one of the rows.

BufferCopy.Copy(originalRow, CopyRow);

Thank you Brandon, that worked.

hi @Jon
Understand you has solve the issue and is possible to share the code you use?
Currently I’m facing the issue on using UBAQ BPM base update to Reject the Requisition but there’s no response and error.

using (var ReqBO = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ReqSvcContract>(Db))
{
      
        var ts = ReqBO.GetByID(20);
        if (ts.ReqHead.Count > 0)
        {
            var originalRow = (Erp.Tablesets.ReqHeadRow)ts.ReqHead[0];
            var copyRow = ts.ReqHead.NewRow();

            BufferCopy.Copy(originalRow, copyRow);
            copyRow.NextActionDesc = "Reject Requisition"; 
            copyRow.NextActionID   = "122"; 
            copyRow.ReplyOption    = "R"; 
            copyRow.ReqUserId      = callContextClient.CurrentUserId; 
            copyRow.RowMod         = "U";  
            ts.ReqHead.Add(copyRow);
            ReqBO.Update(ref ts);
        }

 }

i got error if using this which cant define NextActionDesc, anywhere i has input wrongly?

I don’t see anything that pops out at me. I would have to test to figure it out.