PXDataBase.Update in Acumatica

Hello everybody,

today I want to note how to use PXDataBase.Update in Acumatica. 

Two use-cases.

1. Imagine, you need to set APSubID = 80 in APRegister with APAccountID = 5:

you can use the following:

PXDatabase.Update<APRegister>(new PXDataFieldAssign<APRegister.aPSubID>(80),

new PXDataFieldRestrict<APRegister.aPAccountID>(5),

new PXDataFieldRestrict("DeletedDatabaseRecord"PXDbType.Bit, false));

2. Set DocBal = 80 and DocDesc = “blah blah blah”  in table APRegister with APAccountID = 5 and APSubID = 80:

PXDatabase.Update<APRegister>(new PXDataFieldAssign<APRegister.docBal>(80),

new PXDataFieldAssign<APRegister.docDesc>("blah blah blah"),

new PXDataFieldRestrict<APRegister.aPAccountID>(5),

new PXDataFieldRestrict<APRegister.aPSubID>(80),

new PXDataFieldRestrict("DeletedDatabaseRecord"PXDbType.Bit, false));

From code, which is displayed above you can see, that for assigning values you mention PXDataFieldAssign. PXDataFieldAssign<APRegister.docDesc>("blah blah blah") will be converted into APRegister.docDesc = "blah blah blah"

For setting statement where you can use PXDataFieldRestrict. PXDataFieldRestrict<APRegister.aPAccountID>(5) will be added to Where as APRegister.aPAccountID = 5

No Comments

Add a Comment