I want to stop adding new lines to a sales order based on a condition in Acumatica . How can I do this.?
I tried adding the following. But It did not worked.
protected void SOLine_RowInserting(PXCache cache, PXRowInsertingEventArgs e) {
var row = (SOLine)e.Row;
if (row == null) return;
//Condition
if(Condition == true)
{
Base.Transaction.Delete(row);
}
}
Set AllowInsert
cache property to false from the context of RowSelected
event.
void _(Events.RowSelected<SOLine> e, PXRowSelected baseMethod)
{
baseMethod(e.Cache, e.Args);
bool canInsertCondition = false;
Base.Transaction.Cache.AllowInsert = canInsertCondition;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.