Setvalueext And Setdefaultext In Acumatica


Hello everybody,

today I want to share with you information about two functions:

SetValueExt and SetDefaultExt. 

Names of them are pretty self-explanatory, which means SetValueExt assigns specific value to field and SeDefaultExt assings default value to a field. But SetValueExt  method raises the field-level events for the data field as when a data record is updated. The SetDefaultExt<>()method of the cache to assign the default value a field. The method raises the field-level events for the data field as when a data record is inserted.

No Comments


Add a Comment


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


Web Config Timeout Connection Timeout


Hello everybody,

Today I want to note web.config properties, which took for me some time to discover. It is possible to add two options in connection string of web.config.

1. Timeout=60

2. Connect Timeout=300

What is difference between those two parameters?

The first one set for how long your code at db will be executed. The second one sets for how long your code will wait for result.

No Comments


Add a Comment


How To Block Column In Acumatica Grid Or One Value In Column

How to block column in Acumatica grid or one value in column


I want to share with you how to block some columns in Acumatica.

You can do it with the PXUIFieldAttribute.SetEnabled method.

Let's say you have DAC PRTran with column earningType and values of PRTran you get from PaySlipDetails view. Then you can block whole column with the following call:

PXUIFieldAttribute.SetEnabled<PRTran.earningType>(PaySlipDetails.Cache, null, isEnabled);

Another question which sometime appears is how to block single record value in column.

The solution is the following:

row = .... here goes your logic which will get PRTran for which you need to make blocking

PXUIFieldAttribute.SetEnabled<PRTran.earningType>(PaySlipDetails.Cache,  row, false);


  • Vladislav said

    Hello! But what if I have a CacheExtension and I want to manage availability of its field? I didn't find any way to do it, because SetEnabled (or SetReadonly) accepts only Cache type, but not CacheExtension. Sorry for possibly silly question, I am novice at Acumatica)

  • docotor said

    I propose you to try PXUIFieldAttribute.SetEnabled<PRTranExt.UsrEarningType>(PaySlipDetails.Cache, row, false); I assume that Acumatica should itself try to find extension.

Add a Comment

Current Items In View


Hello everybody,

today I want to share with everybody how to find all items in view in Acumatica.

Suppose you have View declared in the following way:

public PXSelectJoin<PRPayrollDetails,

InnerJoin<EPEmployee, On<EPEmployee.bAccountID, Equal<PRPayrollDetails.employeeID>>,

InnerJoin<PRPayroll, On<PRPayroll.refNbr, Equal<Current<PRPayrollDetails.payrollRefNbr>>>,

LeftJoin<APInvoice, On<APInvoice.refNbr, Equal<PRPayrollDetails.aPRefNbr>, And<APInvoice.docType, Equal<PRPayrollDetails.aPDocType>>>>>>,

Where<PRPayrollDetails.payrollRefNbr, Equal<Current<PRPayroll.refNbr>>>, OrderBy<Asc<PRPayrollDetails.description>>> PayRollsDetails;

and now you made some changes to that view in one of your functions. How to get current situation of view?

If you answered PayRollsDetails.Cache.Cached then you are wrong. You should get them as PayRollsDetails.Select() and only in that way. Then you'll get current situation with items in grid

No Comments

Add a Comment


An Object Reference Is Required For The Non Static Field Method Or Property Px Data Pxselectbase Acumatica Dac Select In Acumatica


Hello everybody,

today I want to share how to fight with error like 

Error 22 An object reference is required for the non-static field, method, or property 'PX.Data.PXSelectBase<Acumatica DAC>.Select(params object[])' bla bla bla

As usually it means that you try to use this in selector of Extension class. Just replace this at Base or Base2 and your problem will go away.

for example 

CR.Location customerLoc = PXSelect<CR.Location, Where<CR.Location.bAccountID, Equal<Required<CR.Location.bAccountID>>, 

                            And<CR.Location.locationID, Equal<Required<CR.Location.locationID>>>>>.Select(this, customer.BAccountID, customer.DefLocationID);

should be 

CR.Location customerLoc = PXSelect<CR.Location, Where<CR.Location.bAccountID, Equal<Required<CR.Location.bAccountID>>, 

                            And<CR.Location.locationID, Equal<Required<CR.Location.locationID>>>>>.Select(Base, customer.BAccountID, customer.DefLocationID);

and your code will be compiled again

Create New Record In Acumatica Or Which Insert Works Faster


Hello everybody,

today I want to share results of my investigations of two similar pieces of functionality in Acumatica.

Have you ever wondered which Insert in cache works faster this:

a) var temp = (PRPayrollDetails)PayRollsDetails.Cache.Insert();

or this:

b)          var temp = new PRPayrollDetails();

             temp = (PRPayrollDetails)PayRollsDetails.Cache.Insert(temp);

If to believe to results of Stopwatch, the second part of code works faster. For my set of data, the first one took 5.5 seconds, while the second option took 4.3 seconds. And this is difference for 300 records. If you have any ideas why it can be, you are welcome to share them.

And if I had 250 records then the difference between option a and b is ~4 seconds

No Comments


Add a Comment


Get Extension Of Basic Dac Class In Acumatica



today I want to share how to get extension of basic DAC class iin Acumatica. Lets say you have class ARTran, and extenstion for it ARTranExt and you want to get it in the code of ARTran_RowUpdated event

Then you can get extenstion in the following way:

   protected virtual void ARTran_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)


            var newRow = (ARTran)e.Row;

            var newRowE = PXCache<ARTran>.GetExtension<ARTranExt>(newRow);





No Comments

Add a Comment

How To Read From Stored Procedure In Acumatica


Hello readers,

today I want to share hwo it is possible to read from stored procedure in Acumatica. Keep in mind, that reading from sp is against best practices of Acumatica, because if you read from sp, then you'll reading will not be cached and other side effects, but sometime you don't have a choice. So, for such cases you can try following approach:

create procedure uspWow

@invnbr nvarchar(6),

@money decimal(19,4) OUTPUT


       SELECT @money = ARInvoice.CuryLineTotal

       FROM ARInvoice

       WHERE ARInvoice.RefNbr = @invnbr;





var invNbr = new PXSPInParameter("invnbr""000595");

var money = new PXSPOutParameter("money"PXDbType.Decimal, 19, 4, null);

var results = PXDatabase.Execute("uspWow"new PXSPParameter[] { invNbr, money});


var sb = new System.Text.StringBuilder("PROC RESULT:\n");

foreach(var r in results)




throw new PXException(sb.ToString());

No Comments

Add a Comment


How To Get Companyid In Acumatica


Hello everybody,

today I want to share how to find current company id in Acumatica:

Here it is:

int? companyid = PX.Common.PXContext.GetSlot<Int32?>("singleCompanyID")

for me it was long way to find it

No Comments

Add a Comment