Is there a way to check if the delete action was pressed in Acumatica screen? This is because I have a code for reloading the StockItems screen, and whenever I am deleting an item it gives me the movenext error, but the item is being deleted successfully. Below is my Reloading Code:
[PXOverride]
public void Persist(Action persist)
{
persist();// this will call base Persist();
InventoryItemMaint grp = PXGraph.CreateInstance<InventoryItemMaint>();
InventoryItem inv = PXSelect<InventoryItem, Where<InventoryItem.inventoryCD, Equal<Required<InventoryItem.inventoryCD>>>>.Select(grp, this.Base.Item.Current.InventoryCD.Trim());
if (inv != null && inv.InventoryID.HasValue)
{
grp.Item.Current = grp.Item.Search<InventoryItem.inventoryID>(inv.InventoryID);
throw new PXRedirectRequiredException(grp, "Reloading Item");
}
}
You can follow the method suggested by Yura, OR you can acheive it in other way i think..
You can check the cache status of the record before calling base persist, if the cache status says it is deleted, dont do your redirect.
The code might be as below [NOT TESTED]
EDIT :
I found that the above code will not work as the InventoryItem
and this is your base problem of movenext error, so i suggest you to update your code as follows