Addition to PXDatabase.Update in Acumatica

Hello everybody,

today I want to share a new feature for me in Acumatica from code standpoint. 

So, suppose that you want to update some column in Acumatica database, but you want to avoid graph creation, loading necessary fields, and all that you need to do is just update column. For example over adding some value.

You can't achieve it with simple call to

PXDatabase.Update<>()

Or if you can, then let me know, because I didn't find the way how to do it. 

But instead I found another new method in Acumatica which is named PXUpdate.

For example you can use this method for adding to each email in table contact value ".someaddition"

PXUpdate<Set<Contact.eMailAdd<Contact.eMailRequired<Contact.eMail>>>, Contact>.Update(Base, ".someaddtion");

What if you want to make update not all fields, but just some of them? Is it possible to add filtering condition? You'd be surprised to know that yes, you can add filtering condition as well. For example like this:

PXUpdate<Set<Contact.eMailAdd<Contact.eMailRequired<Contact.eMail>>>, Contact, 
    Where<Contact.eMailLike<Contact.eMail>>>.Update(Base, ".someaddtion""%somemask%");

With all of this staff you have in your hands two-folds sword: great power and great responsibility, direct update in database.

No Comments

Add a Comment