Could someone show me an example or tell me where I can find information about adding, modifying and deleting records by code? I need to use the UD02 table to record different analysis by part code and using wizard/table as child does not work for this requirement,
I like to use the UpdateExt Method because it does most of the work for you… if the record already exists, it will update the fields you provide. If the record doesnt exist yet, it will add it. You can set RowMod to “D” and it will delete the record.
here is a sample of code. Change the UD Field names to whatever you desire.
using(var svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD12SvcContract>()) {
//Build and add the UD12 record
var UD12 = new Ice.Tablesets.UD12Row {
Company = "MyCompany",
Key1 = "Some Value",
Key2 = "AnotherValue",
Key3 = "",
Key4 = "",
Key5 = "",
};
UD12.SetUDField<System.String>("UDField1_c", "Some Value");
UD12.SetUDField<System.String>("UDField2_c", "Some Valueb");
UD12.SetUDField<System.String>("UDField3_c", "Some Valuec");
//to delete the record uncomment this line: //UD12.RowMod = "D";
ds.UD12.Add(UD12);
BOUpdErrorTableset boUpdateErrors = svc.UpdateExt(ref ds, false, true, out errorOccurred);
}