today I want to write a few words about Generic template methods in Acumatica.
In Acumatica there is such a greate feature as convention over configuration. For example if you want to add reaction in Acumatica on changing the field Description of SOOrder you may do something like this:
protected void SOOrder_OrderDesc_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
and also it's relatively convenient, but inside of that method you'll need to make some casting operations. For quite a long time Acumatica allows to have new format with usage of underscore:
protected void _(Events.FieldUpdated<SOOrder, SOOrder.orderDesc> e)
And take a note of Visual studio hints:
as you can see, Row is not just abstract object staff, but real SOOrder entity, which you can use out of the box without nececity of typecasting.
Saying all of this want to add one grain of salt as for now. If you want to manipulate calling of base methods, then you'll need to use old declaration with fully typing DAC class, Field name, event name.
recently during testing of some logic for me it was necessary to assign some random values to table VendorPart in Acumatica. In order to achieve it, I've created such a script:
update VendorPart set NetPrice = (ABS(CHECKSUM(NEWID()))% 3000.25 + 1.1 + 1), ListPrice= (ABS(CHECKSUM(NEWID()))% 3000.25 + 1.1 + 1)
where NetPrice = 0 and ListPrice = 0
of course such a query will not satisfy all requirements for random numbers generator, but in scope of my business scenario it was better then assign the same value to both columns.
If you want to have some diversity in digits for your values, use NEWID function for assigning values.