BPM C# Code Access _c Fields

I tried searching for this as I am sure it is somewhere on the site, but I could not find it.

How do I reference the extended UD columns in C# code? I’m trying to do a foreach referencing values in UD fields and it won’t compile. It says that the table does not contain a definition for them. Here is the foreach:

foreach (var row in(from qh in ttQuoteHed where
qh.OrderNum_c == null &&
qh.Type_c == "CCO"; || "ICO"
select qh))

Try this.

qh["OrderNum_c"] == 0 &&
qh["Type_c"] == "CCO"
1 Like

Worst-case-scenario, you could always move the conditions into an if statement within the loop.

foreach (var row in (from qh in ttQuoteHed select qh))
{
if (row.OrderNum_c == null && (row.Type_c == “COO” || row.Type_c == “ICO”))
{
/* do something */
}
}

It won’t perform quite as well as a linq query over a large data set, but how many QuoteHed records are you really processing in the tt table?

if @tkoch’s suggestion doesnt work try:

qh.SetUDField<type>("Name Of Field") = value of type you defined 
//ex.
qh.SetUDField<int>("OrderNum_c") = 1000;

//You can also access similarly:
int myOrder = qh.UDField<int>("OrderNum_c") ;

@tkoch - Thank you!