Using UD field in BAQ custom code

I am trying to set the NonConf.CommentText to the UD11.Character02 field based on which UD11 code was selected via dropdown in the NC Entry screen. My dropdown works and I saved the UD 11 code number in the NonConf.RepairCode_c field. My UD column maintenance shows the NonConf table is synced and the field was available in the screen customization as a mapping choice. Why can’t I pick it in my BPM code? When I ctrl+shift to get suggestions I can see the other NonConf fields, but not RepairCode_c.

System.Drawing.Bitmap CS1061 ‘NonConfRow’ does not contain a definition for ‘RepairCode_c’ and no extension method ‘RepairCode_c’ accepting a first argument of type ‘NonConfRow’ could be found (are you missing a using directive or an assembly reference?)

//get UD11 table
Ice.Tables.UD11 UD11;

//get temp table for updated NonConf record
var NewRecord = ttNonConf.FirstOrDefault();

//get key1 code from new record
var code = NewRecord.RepairCode_c;
  
//link UD11 and NonConf on UD11.Key1
UD11 = (from UD11_row in Db.UD11
        where UD11_row.Company == Session.CompanyID
        && UD11_row.Key1 == code
        select UD11_row).FirstOrDefault();
        
//set NonConf.CommentText to UD11.Character02
NewRecord.CommentText = UD11.Character02;

Have you tried the GetUDField method?:
NewRecord.GetUDField<System.String>("RepairCode_c")

Edit: As noted in the solution, the actual method is UDField

1 Like

That almost worked but put me on the right path!! Thanks

var code = NewRecord.UDField<System.String>(“RepairCode_c”);

1 Like

I’m glad you got there despite my error!