Acumatica · Workflow

Acumatica Workflow Engine — The Definitive Guide

A complete reference to the Acumatica workflow engine — states, transitions, conditions, automated actions, parallel approvals, and the patterns that model real business approval flows.

John Kihiu15 min read

The Acumatica workflow engine is the cleanest way to model a multi-step approval or lifecycle in the platform. Used well, it removes 80% of the custom code you would otherwise write. Used poorly, it becomes a maintenance burden. This guide is the well-used version.

1. Concepts

Acumatica's workflow engine is state-machine based:

2. Where the workflow lives

A workflow is defined inside a graph extension. The PXWorkflow base class hosts the states and transitions.

C# · MINIMAL WORKFLOW
public class SOOrderApprovalWF :
    PXGraphExtension<PXGraph>
{
    public sealed class MyStates : PX.Data.PXWorkflowStatusAttribute
    {
        public const string Draft = "D";
        public const string Pending = "P";
        public const string Approved = "A";
        public const string Rejected = "R";
    }
}

3. Defining transitions

Each transition has a name, source state, target state, and a condition function. The condition is what makes the transition visible/enabled in the UI.

4. Auto-approve rules

The most common workflow pattern is "if total < X, auto-approve; else require manager approval". The auto-approve is a transition with a condition, taken automatically in the handler.

5. Parallel approvals

Acumatica supports parallel approval groups (defined on the Employee screen). A document transitions to Approved when all groups have approved, or to Rejected if any group rejects. Configure the group structure first, then the workflow.

6. Email notifications

Pair the workflow with Acumatica's Business Events to send email on transition. Configure the event in the Business Events screen, trigger it from the workflow action handler.

7. Common patterns

ScenarioPattern
Single manager approvalLinear: Draft → Pending → Approved
Two-step approvalSequential: Draft → Pending1 → Pending2 → Approved
Multi-group approvalParallel groups, all must approve
Auto-approve under thresholdCondition on transition: total < X
Conditional rejectionRejection transition with reason capture

8. Common mistakes

9. Upgrade safety

Workflows survive upgrades well — the state names and transitions are yours, not the platform's. The risk is on the handler side: if the handler calls a method that gets renamed in an upgrade, the workflow breaks. Wrap handler logic in your own service classes.

Related reading

Going deeper: production-grade patterns

The patterns above cover the basics. In production, the same patterns have to survive three things: scale, edge cases, and the next Acumatica upgrade. Here are the patterns that distinguish a working customisation from a great one — the ones I have applied to every client project in East and Southern Africa, and the ones that make the difference between a customisation the user trusts and a customisation they curse.

Defensive coding for the unexpected

Production is where the assumption dies. Every customisation that "works in test" fails in production the first time a customer name has a special character, an invoice is in a foreign currency, or a record has a null in a field you thought was required. The defensive habit is to explicitly handle the null, the empty, the special character, and the foreign currency in every event handler and every code path. The cost is 20% more code. The payoff is 95% fewer production tickets.

Three patterns I apply everywhere:

C# · DEFENSIVE PATTERN
public class DefensiveExt : PXGraphExtension<BaseGraph>
{
    protected void _(Events.RowSelected<MyDAC> e)
    {
        var row = e.Row;
        if (row == null) return;                          // null-safe
        var ext = row.GetExtension<MyDACExt>();
        if (ext == null) return;                         // null-safe extension
        var value = ext.UsrField ?? "DEFAULT";           // null-coalesce
        var ok = decimal.TryParse(value, out var n);    // try-parse
        if (!ok) { /* handle */ }
    }
}

Performance: the patterns that scale

Five performance patterns I apply on every customisation, in order of impact:

  1. Move heavy logic out of RowSelected. Push validation to RowPersisting, side effects to a graph action triggered by a button. RowSelected fires for every row on every render.
  2. Index the join columns. Every BQL Where<> filter needs an index. Check the execution plan before you ship.
  3. Filter at the GI, not the UI. A GI that returns 5 million rows and filters in the presentation layer will time out. Push filters into the Conditions tab.
  4. Batch the work. Loop with 1,000 calls is slow; loop with 10 calls of 100 records is fast. Batch where you can.
  5. Cache the static. Tax schedules, account lists, and other static reference data can be cached for the lifetime of the app pool. Reduce the database load.

For the full performance playbook, see the performance tuning guide and the SQL Server indexing guide.

Upgrade survival

The customisation that breaks on the next Acumatica upgrade is the one that took a shortcut. The patterns that survive:

C# · USR PREFIX CONVENTION
// Base field — Acumatica owns this
[PXDBString(40)]
public string RefNbr { get; set; }

// Your field — always Usr prefix, never collides
[PXDBString(40)]
[PXUIField(DisplayName = "External Ref")]
public string UsrExternalRef { get; set; }

// Your DAC extension — soft extension, survives table drops
[PXTable(IsOptional = true)]
public class MyDACExt : PXCacheExtension<MyDAC>
{
    #region UsrCustomField
    [PXDBString(60)]
    public string UsrCustomField { get; set; }
    public abstract class usrCustomField :
        PX.Data.BQL.BqlString.Field<usrCustomField> { }
    #endregion
}

Testing: the habit that pays for itself

If you are not testing your customisation with the Acumatica Unit Test Framework, you are running blind. The framework ships with every installation, costs nothing, and pays for itself the first time an upgrade changes a method signature on you. The minimum coverage:

For the full test framework walkthrough, see the unit test framework guide.

Operations: what to do after the customisation is live

A customisation is not "done" when it ships. It is "done" when it has run in production for a quarter without a critical incident. The operational habits that get you there:

For the broader operational patterns, see the monitoring guide and the licence concurrency guide.

The migration off the old customisation

Every customisation is eventually replaced. Plan for that day from the start. The patterns:

For the broader migration patterns, see the data migration guide.

Wrapping up

That is the working approach I use on Acumatica projects. The same patterns show up whether you are in Nairobi, Johannesburg, Kigali, Lusaka or Harare — and they are the things that keep work moving when an upgrade lands at 6 PM on a Friday. If you are stuck on something specific, reach out or keep reading through the rest of the Acumatica blog.