Skip to main content
Answer

Updating Unit Price on a Sales Order in Completed State

  • October 1, 2025
  • 1 reply
  • 39 views

Hello,

I am trying to build a customization where I want to make the Unit Price (CuryUnitPrice) column on SOLine editable even when the Sales Order is in the Completed state.

I have been able to make the field editable, and after updating the value, the Save button is also available to save the updated changes.
 

However, when I click the Save button and try to save the updated value, I am getting the following error:
 

 

Here is my code for the Graph Extension as well as the Workflow Extension.

Workflow Extension:

public class SOOrderEntry_Workflow_Ext : PXGraphExtension<PX.Objects.SO.SOOrderEntry_Workflow, SOOrderEntry>
{
public static bool IsActive() => true;

public override void Configure(PXScreenConfiguration config) =>
Configure(config.GetScreenConfigurationContext<SOOrderEntry, SOOrder>());

protected virtual void Configure(WorkflowContext<SOOrderEntry, SOOrder> context)
{
context.UpdateScreenConfigurationFor(screen =>
screen.WithFlows(flows =>
flows.Update<SOBehavior.sO>(flow =>
flow.WithFlowStates(states =>
states.Update<SOOrderStatus.completed>(state =>
state
.WithActions(acts =>
{
acts.Add(g => g.Save);
acts.Add(g => g.Cancel);
})
.WithFieldStates(fields =>
{
fields.RemoveField<SOLine.curyUnitPrice>();
fields.AddField<SOLine.curyUnitPrice>();
})
)
)
)
)
);
}
}

 

Graph Extension:

protected virtual void _(Events.RowSelected<SOLine> e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(e.Cache, e.Args);
var line = e.Row;
if (line == null) return;

var order = Base.Document.Current;

bool allowInCompleted = CanEdit(order, line);
if (!allowInCompleted)
return;

Base.Document.Cache.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;

PXUIFieldAttribute.SetEnabled<SOLine.curyUnitPrice>(e.Cache, line, true);

if (line.ManualPrice != true)
e.Cache.SetValueExt<SOLine.manualPrice>(line, true);
}

protected virtual void _(Events.RowSelected<SOOrder> e, PXRowSelected baseHandler)
{
baseHandler?.Invoke(e.Cache, e.Args);
var doc = e.Row;
if (doc == null) return;

bool completed = string.Equals(doc.Status, SOOrderStatus.Completed, StringComparison.OrdinalIgnoreCase);
if (!completed) return;

Base.Document.Cache.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;

Base.Actions[nameof(SOOrderEntry.Save)]?.SetEnabled(true);
Base.Actions[nameof(SOOrderEntry.Cancel)]?.SetEnabled(true);
}

 

If anyone could help me with this, it would be really helpful.

 

Kind Regards,
Dhruv

Best answer by Abhishek Niikam

Hello ​@dhruv40 

  • SOOrder in Completed status  by design, completed orders are “locked.”
    Even if you enable fields, Acumatica’s base graph (SOOrderEntry) prevents saving updates once the order is completed.

  • You’ve enabled editing in UI, but when calling Save, Acumatica still validates the state and refuses to persist.

  • Base.Document.Cache.AllowUpdate = true; only affects UI behavior, not business rules.

  • In SOOrderEntry, Persist logic disallows updates for Completed orders. That’s why you get this popup.

If your requirement is truly to allow price correction after completion (which is risky in production), you’ll need to override persistence validation. &

Suppress validation that blocks updates. Some validations may still fire in RowPersisting or SOOrderEntry.Persist.

OR

Safer option:
temporarily reopen the sales order (set the status back to Open), allow the price change, and then move the order back to Completed.

I hope it helps!

1 reply

Forum|alt.badge.img+2
  • Jr Varsity II
  • Answer
  • October 2, 2025

Hello ​@dhruv40 

  • SOOrder in Completed status  by design, completed orders are “locked.”
    Even if you enable fields, Acumatica’s base graph (SOOrderEntry) prevents saving updates once the order is completed.

  • You’ve enabled editing in UI, but when calling Save, Acumatica still validates the state and refuses to persist.

  • Base.Document.Cache.AllowUpdate = true; only affects UI behavior, not business rules.

  • In SOOrderEntry, Persist logic disallows updates for Completed orders. That’s why you get this popup.

If your requirement is truly to allow price correction after completion (which is risky in production), you’ll need to override persistence validation. &

Suppress validation that blocks updates. Some validations may still fire in RowPersisting or SOOrderEntry.Persist.

OR

Safer option:
temporarily reopen the sales order (set the status back to Open), allow the price change, and then move the order back to Completed.

I hope it helps!