Hi all,
I’m working on implementing a Business Process Management (BPM) directive in Epicor Kinetic, and I need some guidance.
The requirement is:
To display a warning message whenever a user reopens a Sales Order Line or Release — specifically when the
OpenLine
orOpenRelease
fields are changed fromfalse
totrue
.
So far, I’ve attempted a Pre-Processing Method Directive onSalesOrder.Update
using custom C# code to detect whenOpenLine
is set totrue
, and then check for related closedOrderRel
records. However, the warning does not show at all when users use the “Actions → Reopen Line” or “Reopen Release” functionality in the Kinetic UI.
foreach (var ttRelRow in ttOrderRel)
{
// Only check updated rows
if (ttRelRow.RowMod == "U")
{
// Check if OpenRelease changed from false to true
bool wasClosed = false;
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
var currentRel = Db.OrderRel
.Where(rel =>
rel.Company == Session.CompanyID &&
rel.OrderNum == ttRelRow.OrderNum &&
rel.OrderLine == ttRelRow.OrderLine &&
rel.OrderRelNum == ttRelRow.OrderRelNum)
.FirstOrDefault();
if (currentRel != null && currentRel.OpenRelease == false)
{
wasClosed = true;
}
}
// If release was previously closed and now open
if (wasClosed && ttRelRow.OpenRelease == true)
{
string msg = $"Warning: You have reopened Release #{ttRelRow.OrderRelNum} on Line {ttRelRow.OrderLine}. Ensure this is intentional.";
ExceptionManager.AddWarning("ReopenReleaseWarning", msg);
}
}
}
any help will be highly appreciated