Accessing UD tables from BPM

Does anyone know how can I access Custcnt_UD table from by BPM code?
I am getting error on my code where I am accessing DB.CustCnt_UD

“ErpContext doe not contain a definition of CustCnt_UD”

Blockquote
var PrintCount = (from sh in Db.InvcHead
join sv in Db.InvcDtl on new { sh.Company, sh.InvoiceNum } equals new { sv.Company, sv.InvoiceNum }
join cu in Db.Customer on new { sv.Company, sv.CustNum } equals new { cu.Company, cu.CustNum }
join cnt in Db.CustCnt on new { cu.Company, cu.CustNum } equals new { cnt.Company, cnt.CustNum }
join cud in Db.CustCnt_UD on new { cnt.SysRowID } equals new { cud.ForeignSysRowID }

You don’t need to access UD tables separately. Accessing CustCnt gives you access to the CustCnt_UD fields. The only caveat is that in BPMs you need to use table[“field”] syntax. For example this is a BPM that populates an OrderHed_UD Field when an order is placed on hold:

var oh = dsOrderHed.Where(r => r.Added() || r.Updated()).FirstOrDefault();

if ( oh == null ) return;

bool HoldChange = oh.Added()? oh.OrderHeld :
				ds.OrderHed.Any(r1 => r1.Unchanged() 
					&& r1.SysRowID  == oh.SysRowID 
					&& r1.OrderHeld != oh.OrderHeld);

if ( !HoldChange ) return;

if ( oh.OrderHeld )
{
    oh["dtOnHold_c"] = BpmFunc.Today();
}

1 Like

Oh yes. I can. Thanks haven’t checked that before.