Trying to update Customer from CustCnt.Update post-processing BPM

Figured it out thanks to @josecgomez in this post:

Here’s the working code:


foreach (var custCntRow in ttCustCnt)
{
  if (this.callContextBpmData.Checkbox08)
  {
    this.callContextBpmData.Checkbox08 = false;
   
    int custNum = custCntRow.CustNum;

    bool reqAuthBuyers = Db.CustCnt.Any(cc => cc.Company == custCntRow.Company

                  && cc.CustNum == custNum

                  && cc.CheckBox06);
   
    var custSVC = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.CustomerSvcContract>(this.Db);
    using (custSVC)
    {
       CustomerTableset custDS = custSVC.GetByID(custNum);
       var custNew = (CustomerRow)custDS.Customer.NewRow();
       BufferCopy.Copy(custDS.Customer[0], custNew);
       custNew["CheckBox07"] = reqAuthBuyers;
       custNew.RowMod = "U";
      
       custDS.Customer.Add(custNew);      

       custSVC.Update(ref custDS);
    }

   
    // using this to trigger an oTrans.Refresh() in customization

    this.callContextBpmData.Checkbox09 = true;  
  }
}