...or perhaps I’m not using it properly.
I’m experimenting with TimeStamp to understand Acumatica’s locking better.
I’ve created the following code, a simple button call the press save.
public class SOOrderEntry_Extension : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
{
public static bool IsActive() => true;
public PXAction<SOOrder> CheatSave;
vPXButton(CommitChanges = true)]
ePXUIField(DisplayName = "Cheat Save")]
protected void cheatSave()
{
var a = Base.TimeStamp;
Base.SelectTimeStamp();
var b = Base.TimeStamp;
Base.Actions.PressSave();
}
}
The button appears on the main menu.
When I go to an existing order, update the Description and press ‘CHEAT SAVE’ it works, the change is saved.
If I go to an existing order, update the Description, then update the description in SQL (using update SOOrder set OrderDesc = 'Z' where OrderNbr = 'SO023847'), and press ‘CHEAT SAVE’ I get the following message.
“Error: Another process has updated the 'SOOrder' record. Your changes will be lost.”
This message would be expected but I thought that calling Base.SelectTimeStamp would refresh the TimeStamp value stored against the graph and allow the update to be saved. By stepping through the code and checking variables a and b, I can see that the Base.TimeStamp value is refreshed after I updated the record from SQL.
Have I misunderstood what SelectTimeStamp should do?