Updating table through bpm code

one really good way to add/update tables is to use the process’s UpdateExt method. It allows you to create a tableset for an entire order, and then call SalesOrder.UpdateExt, and the order will be added/updated.

Here is some sample code from a BPM that will automatically add/update to UD12.

    using (var svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD12SvcContract>())
      {
      
      
      //Build and add the UD12 record
      var UD12 = new Ice.Tablesets.UD12Row
        {
          Company = ordRel.Company,
          Key1 = ordRel.OrderNum.ToString(),
          Key2 = "1",
          Key3 = "",
          Key4 = "",
          Key5 = "",
          ShortChar01 = "This is a base field",
        };
        //now the ud fields
        UD12.SetUDField<System.String>("MyUDField1_c", "some data");
        UD12.SetUDField<System.String>("MyOtherField_c, "more data");
       
        //add the record to our dataset
        ds.UD12.Add(UD12);
        
        BOUpdErrorTableset boUpdateErrors = svc.UpdateExt(ref ds, false,true, out errorOccurred);
        if (errorOccurred) {do something}; else {do something else};
           
      }
7 Likes