Assemblys/Usings needed for writing to UD table

,

In BPM custom code I need to write to a UD table, UD01.

Following this comment, I have this code chunk:

using(var UD01svc = Ice.Assemblies.ServiceRenderer.GetService<UD01SvcContract>(Db))
        {
        UD01Tableset ds = new UD01Tableset();
        UD01svc.GetaNewUD01(ref ds);
        ds.UD01[0].Key1 ="XX";
        ds.UD01[0].Key2 = "YY";
        ds.UD01[0].Key3 = "ZZ";
        UD01svc.Update(ref ds);
        }

And in Assemblys, I added:

Ice.Contracts.BO.UD01

But when I check syntax I get:

CS0246 The type or namespace name ‘UD01SvcContract’ could not be found (are you missing a using directive or an assembly reference?)

Is there an additional assembly I need or something added under Usings?

WHy are you calling get a new UD02 if you are updating UD01?

That is a typo. The original code chunk I copied was for UD02. Fixing that does not resolve the error, though.

You need the appropriate using statement. Something like

Using Ice.Contracts.XYZ

I should note that this is a Standard Data Directive.

I tried add Using statements (“using Ice.Contracts.BO;” or “using Ice.Contracts.BO.UD01;”) but neither resolved the issue.

I just saw this comment on another post, and when I copied the code chunk to a Method Directive with just the same Assembly added, then Check Syntax was OK.

If this can’t be done from a DD, this is going to be a major problem. But the DD still has the Invoke BO Method widget, so I am assuming it can be done.

Found this comment, with some different syntax, which does pass Check Syntax:


Ice.Contracts.UD01SvcContract UD01svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD01SvcContract>(Db);
UD01Tableset ds = new UD01Tableset();
UD01svc.GetaNewUD01(ref ds);
ds.UD01[0].Key1 ="XX";
ds.UD01[0].Key2 = "YY";
ds.UD01[0].Key3 = "ZZ";
UD01svc.Update(ref ds);

In Assemblies:

Ice.Contracts.BO.UD01

I still need to test and see if it actually works, though.

EDIT: Confirmed that this works as expected.