How to set some value in Acumatica screen and tell about it to Acumatica
today I want to write a short note about persisting something to Acumatica.
Sometime it happens that in your code you have something like this:
SomeDacInstance.Field = somevalue;
and following workflow:
User clicks on save, you code is executed, you go in record, refresh page and surprise: somevalue is not there. How to deal with it? In such cases you'll need to use method SetValueExt.
For example one of readers of mine blog had the following code:
row.LotSerialNbr = modificado2;
but that approach didn't save value for two reasons:
1. simple assign of value doesn't tell acumatica cache about any changes.
2. Inserting something in the cache marks that something was changed, but that particular code will add new one record, and not modify existing one.
but following code should work:
Base.lsselect.SetValueExt<POReceiptLine.lotSerialNbr>(Base.lsselect.Current, modificado2 );