Skip to main content
Solved

Workflow Editor Production Order Maintenance Screen "Unknown Status"

  • May 16, 2025
  • 4 replies
  • 73 views

bwhite49
Captain II
Forum|alt.badge.img+11

Anybody familiar with this error? I added 3 statuses before planned status on the production order maintenance screen through the workflow editor (no code).

Everything works well except I can’t delete the production order when in one of the 3 newly created statuses as well as the events table does not populate with order changes. Trying to delete presents the error in the screenshot below. When moving from “On Hold” status to one of these new statuses the events table states that the order moved from “On Hold” to “Unknown” rather than “On Hold” to “Initialized.”

Anybody know how to fix this “Unknown Status” issue?

 

 

Best answer by VidhyaHari

Hello ​@bwhite49, Based on my debugging, it seems like the issue is caused by StatusID check happening in AMProdItem_RowDeleting event which leads to the error. Overriding the event to avoid the validation for your custom statuses as below would fix this error:

protected virtual void AMProdItem_RowDeleting(PXCache cache, PXRowDeletingEventArgs e, PXRowDeleting basemethod)
{
var amProdItem = (AMProdItem)e.Row;
if (amProdItem == null)
{
return;
}

if (amProdItem.Hold.GetValueOrDefault())
{
throw new PXSetPropertyException(Messages.GetLocal(Messages.ProdStatusDeleteInvalid, Messages.Hold));
}
if (!(amProdItem.StatusID.EqualsWithTrim("Q") || amProdItem.StatusID.EqualsWithTrim("W") || amProdItem.StatusID.EqualsWithTrim("E")))
{
if (!amProdItem.StatusID.EqualsWithTrim(ProductionOrderStatus.Planned))
{
var label = ProductionOrderStatus.GetStatusDescription(amProdItem.StatusID.TrimIfNotNullEmpty().ToUpper());
throw new PXSetPropertyException(Messages.GetLocal(Messages.ProdStatusDeleteInvalid, label));
}
}
if (!Base.IsContractBasedAPI && !Base.IsImport && !Base.IsImportFromExcel)
{
var relatedOrders = Base.relatedProdOrders.Select().RowCast<AMProdItemRelated>().ToList();
if (relatedOrders.Any())
{
string[] relatedOrderNumbers = relatedOrders.Select(s => $"{s.OrderType} - {s.ProdOrdID}").ToArray();
if (Base.relatedProdOrders.Ask(
Messages.DeleteProductionOrderTitle,
Messages.GetLocal(Messages.LinkedOrderAllocationDeleteConfirmation, string.Join(", ", relatedOrderNumbers)), MessageButtons.YesNo) != WebDialogResult.Yes)
{
e.Cancel = true;
return;
}
}
}

if (Base.ContainsSOReference)
{
AMConfigurationResults confRow = Base.ItemConfiguration.SelectWindowed(0, 1, new object[] { amProdItem });

if (!Base.IsImport)
{
if (Base.ProdMaintRecords.Ask(Messages.ConfirmDeleteTitle, Messages.ConfirmSOLinkedOrderDelete, MessageButtons.YesNo) != WebDialogResult.Yes)
{
e.Cancel = true;
}
}
if (confRow != null && e.Cancel == false)
{
//We don't want to delete the Configuration if it's still linked with a SOLine
PXParentAttribute.SetLeaveChildren<AMConfigurationResults.prodOrderNbr>(Base.Caches[typeof(AMConfigurationResults)], null, true);

//We want to remove the linked with the defunct production order.
confRow.ProdOrderType = null;
confRow.ProdOrderNbr = null;
this.Base.ItemConfiguration.Update(confRow);
}
}

if (ProductionTransactionHelper.ProductionOrderHasUnreleasedTransactions(this.Base, amProdItem, out var unreleasedMsg))
{
throw new PXException(unreleasedMsg);
}

}

Hope this helps! 

4 replies

Forum|alt.badge.img+1
  • Acumatica Moderator
  • Answer
  • June 2, 2025

Hello ​@bwhite49, Based on my debugging, it seems like the issue is caused by StatusID check happening in AMProdItem_RowDeleting event which leads to the error. Overriding the event to avoid the validation for your custom statuses as below would fix this error:

protected virtual void AMProdItem_RowDeleting(PXCache cache, PXRowDeletingEventArgs e, PXRowDeleting basemethod)
{
var amProdItem = (AMProdItem)e.Row;
if (amProdItem == null)
{
return;
}

if (amProdItem.Hold.GetValueOrDefault())
{
throw new PXSetPropertyException(Messages.GetLocal(Messages.ProdStatusDeleteInvalid, Messages.Hold));
}
if (!(amProdItem.StatusID.EqualsWithTrim("Q") || amProdItem.StatusID.EqualsWithTrim("W") || amProdItem.StatusID.EqualsWithTrim("E")))
{
if (!amProdItem.StatusID.EqualsWithTrim(ProductionOrderStatus.Planned))
{
var label = ProductionOrderStatus.GetStatusDescription(amProdItem.StatusID.TrimIfNotNullEmpty().ToUpper());
throw new PXSetPropertyException(Messages.GetLocal(Messages.ProdStatusDeleteInvalid, label));
}
}
if (!Base.IsContractBasedAPI && !Base.IsImport && !Base.IsImportFromExcel)
{
var relatedOrders = Base.relatedProdOrders.Select().RowCast<AMProdItemRelated>().ToList();
if (relatedOrders.Any())
{
string[] relatedOrderNumbers = relatedOrders.Select(s => $"{s.OrderType} - {s.ProdOrdID}").ToArray();
if (Base.relatedProdOrders.Ask(
Messages.DeleteProductionOrderTitle,
Messages.GetLocal(Messages.LinkedOrderAllocationDeleteConfirmation, string.Join(", ", relatedOrderNumbers)), MessageButtons.YesNo) != WebDialogResult.Yes)
{
e.Cancel = true;
return;
}
}
}

if (Base.ContainsSOReference)
{
AMConfigurationResults confRow = Base.ItemConfiguration.SelectWindowed(0, 1, new object[] { amProdItem });

if (!Base.IsImport)
{
if (Base.ProdMaintRecords.Ask(Messages.ConfirmDeleteTitle, Messages.ConfirmSOLinkedOrderDelete, MessageButtons.YesNo) != WebDialogResult.Yes)
{
e.Cancel = true;
}
}
if (confRow != null && e.Cancel == false)
{
//We don't want to delete the Configuration if it's still linked with a SOLine
PXParentAttribute.SetLeaveChildren<AMConfigurationResults.prodOrderNbr>(Base.Caches[typeof(AMConfigurationResults)], null, true);

//We want to remove the linked with the defunct production order.
confRow.ProdOrderType = null;
confRow.ProdOrderNbr = null;
this.Base.ItemConfiguration.Update(confRow);
}
}

if (ProductionTransactionHelper.ProductionOrderHasUnreleasedTransactions(this.Base, amProdItem, out var unreleasedMsg))
{
throw new PXException(unreleasedMsg);
}

}

Hope this helps! 


bwhite49
Captain II
Forum|alt.badge.img+11
  • Author
  • Captain II
  • June 2, 2025

That’s great, thank you. The other outstanding issue is the events table. 

When going to on hold or removing hold from one of these statuses, the events table states that the order went from on hold → unknown status or unknown status → on hold.

So far it does not appear that the “unknown status” issue causes any data corruption or prevents anything from happening in the system outside of deleting production orders, but we have not published this to a live system as we are a little concerned.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • July 7, 2025

Hi ​@bwhite49 were you able to find a solution? Thank you!


bwhite49
Captain II
Forum|alt.badge.img+11
  • Author
  • Captain II
  • July 7, 2025

Yes/No 

This code allows the production order to be deleted, but there is still and issue with the events table leaving a trace of “unknown” status. This issue is documented in a dev case and we are awaiting a solution for that.

That said, this workflow customization was published on a live site and there are no issues to note beyond the events table updating incorrectly.