Delete UserComp via BO

Ever since moving to E11 I have been having similar issues trying to delete things even on UD tables.

Found a nice snippet from Jose at one point, don’t remember the post or I’d tag it. This is what I got working though using a SvcContract, seems to be about the only reliable one I’ve been using lately.

Ice.Contracts.UD01SvcContract UD01Svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD01SvcContract>(Db);

var list = Db.UD01.Where(I => I.Key1 == "YourFilter").ToList();

if (list != null && list.Count > 0)
  foreach (var row in list)
  {
      UD01Tableset tableset = UD01Svc.GetByID(row.Key1, row.Key2, row.Key3, row.Key4, row.Key5);
      
      tableset.UD01[0].RowMod = "D";
      
      UD01Svc.Update(ref tableset);
  }

Maybe a similar approach will work - letting the Db context close the table so it’s free to update again (or at least my guess as to what’s happening).