Skip to main content

Process - Purchase order change and delta re-approval

What changes when Warden governs a purchase order, and what does not.

This document walks one process end to end: a buyer edits a purchase order that has already been confirmed. It is the flagship Warden control (Package A), and it is the clearest example of the product's shape - Warden does not replace a standard D365 process, it intercepts one.

Read FORM_REFERENCE.md for the screens named here, and SCENARIOS.md for the same ground told as worked examples with expected outcomes.


1. The standard process, unchanged​

Without Warden, editing a confirmed purchase order in D365 goes:

  1. Buyer opens the PO and edits a field.
  2. If change management is on, the edit puts the order into a change request and native re-approval evaluates whether the change is material, using the re-approval policy rule field list - a configured set of fields that force re-approval when they move.
  3. The order routes for approval if required, or the buyer confirms it directly if not.
  4. Confirm posts the confirmation.

Warden changes none of these four steps. Native change management still runs. Native re-approval still runs. The confirmation journal is still native. Warden adds a parallel evaluation and, when its own policy says so, a gate.

That distinction matters for support: if a customer reports that native change management behaves oddly, Warden is almost certainly not the cause - it never edits native state on this path.


2. Where Warden intervenes​

Six seams, in the order the process hits them.

#Native seamWarden extensionWhat it does
1PurchTable.updateMGCWardenPurchTable_ExtensionClassifies the header edit before the write proceeds
2PurchLine.updateMGCWardenPurchLine_ExtensionSame, for line edits
3PurchReApprovalPolicyRuleFieldListMGCWardenPurchReApprovalFieldList_ExtensionWithholds nominated fields from the native re-approval picker
4PurchReApprovalCompareRecordVersionsMGCWardenPurchReApprovalCompare_ExtensionRemoves nominated fields from the native compare predicate
5PurchFormLetter.validate and .runMGCWardenPurchFormLetter_ExtensionRefuses to post while an active governance hold stands
6ReqTransPoMarkFirmMGCWardenFirmingSubscriberHolds a firmed PO over the firming threshold

The customised part, step by step​

Step 1 - the edit is classified, inside the caller's transaction. MGCWardenChangeInterceptor reads the field change matrix on the active policy version and decides one of four verdicts for the edit: log, band, route or block.

Only two things ever block: a Block-class field change, and an active blocking hold. Both are policy-intended gates.

This work happens inside a transaction the caller already opened - PurchTable.update begins with if (appl.ttsLevel() == 0) throw error(...), so Warden's wrapper is always nested. X++ does not run a catch block inside a transaction unless it names UpdateConflict or DuplicateKeyException, and Warden's is bare, so this seam is fail-closed by platform constraint: what protects the buyer's edit is not exception handling but the shape of the work - keyed reads and bounded writes on Warden-owned tables only.

Step 2 - bands measure cumulative drift, not the single edit. A band verdict compares the new value against the field approval baseline, not against the value before this particular keystroke. A price that moves 2% four times has drifted 8%, and the fourth edit is what trips an 8% band.

This is the most common source of "but I barely changed it" disputes. The number being disputed is on Field approval baselines - that screen exists specifically so the answer to a challenge against an automated control does not live only in the database.

Step 3 - the diff set is written, and the hold is placed. Warden writes a diff set (header) and diff lines (one per changed field, each carrying its field class and band verdict), raises governance event rows, and - where the verdict is route or block - places a hold.

The hold commits or rolls back with the edit itself. That is stronger than deferring it: there is no window in which the change has landed but the gate has not.

Step 4 - the approval is raised outside the transaction. Workflow activation and the HoldPlaced business event cannot run in the transaction, so they are deferred to PurchFormLetter.validate, which is verified transaction-free.

If the buyer edits and then abandons the order without ever opening the posting dialog, that deferred activation never fires. The Warden delta route drain batch is the backstop. Nothing in the product schedules it: the administrator gives it a recurrence of five minutes (GETTING_STARTED.md §6b), a stated service-level promise of no more than five minutes between a change being held and its approver seeing a work item. While it has no recurrence and a policy would hold a change, Warden setup gaps reports it (see Route drains).

Consequence worth knowing. The approval work item is created lazily - at the next confirm attempt or by the drain - not synchronously with the edit. Anyone who has seen the product demo will notice the gap. Nothing escapes governance in it, because the hold is immediate.

Step 5 - the approver decides. The approver sees the change set in the work list itself, via the diff FactBox on Work items assigned to me - they do not have to open the document to see what they are approving. Opening the full consolidated diff panel gives old → new per field with the band verdict.

The panel recomputes its totals at open. The diff set is append-only evidence captured at edit time, so a panel opened days later against a since-changed record would otherwise show a snapshot that had silently gone stale. It re-reads the live record, reports how many recorded values no longer match and how many later change sets exist, and says so in plain words. No evidence row is mutated to do it.

At the approve action two further gates apply:

  • Signing limits - checked at approve time on both the in-client and API channels.
  • Electronic signature - where the policy's e-signature switch demands one (21 CFR §11.50).

Step 6 - approval releases the hold and re-baselines. Approval outcome releases the hold and, depending on the field class, re-baselines the field so the next band measures drift from the newly approved value.

Step 7 - confirmation is gated until then. MGCWardenPurchFormLetter_Extension wraps both validate() and run(). The load-bearing one is run():

PurchFormLetter.run() calls reArrange(false, false, true), and reArrange only calls validate() behind if (_validate && ...) - the second positional argument is _validate and it is passed false. So validate() is not on the run() path at all.

validate() covers the interactive posting dialog and the Rearrange and Totals buttons - every caller needs a human in front of a dialog. run() is what catches everything else, including batch and API posting.


3. The exits​

A held order has exactly three ways forward. Support should know all three.

ExitWhoWhat it leaves behind
ApproveThe approver named by the workflowApproval event, hold released, field re-baselined
Reject / returnThe approverOrder stays held; originator corrects and resubmits
Break-glassBreak-glass holder onlyReason-coded, time-boxed grant; audited event; grant expires via batch

Break-glass is the release valve of last resort, not a workflow step. Every release is an audited event and the grant expires on its own.


4. The three excluded document classes​

There are three document families where a blocking posture can be softened per-parameter:

  • Direct delivery
  • Intercompany
  • TMS-loaded

The interceptor tests the effective posture from MGCWardenPolicyEngine::effectivePosture, not the policy's own - the DegradeToWarnDD / DegradeToWarnIC / DegradeToWarnTMS switches on Warden guard parameters soften a Blocking policy to LogOnly for those families.

A softened verdict is never silent. The user gets a warning naming what a Blocking posture would have done, and a DegradedToWarn event carries the same sentence into the governance log beside the diff set, which is still written.

Read the group caption on the parameters form before using these. Softening two of the three leaves the third still enforcing - which is precisely the surprise the third switch and that caption exist to prevent.


5. The re-approval exclusion, which works the other way round​

The re-approval exclusion is the one part of this process where Warden narrows a native control rather than adding one.

Re-approval exclusions nominates fields that should no longer trigger the native purchase-order re-approval rule while change management stays active. Two extensions deliver it, and both are needed because the native picker and the native compare predicate share one structure:

  • The field is withheld from the Available list in the re-approval policy setup picker.
  • A field already stored in the policy is kept in the Selected list and labeled, rather than vanishing - otherwise an administrator would see a configured field silently disappear.

Warden's own governance is unaffected by this. A field excluded from native re-approval is still classified by the field change matrix, and can still band, route or block.


6. What the process looks like when the feature is off​

Turning Order Guard off stops the entry points - the seams that classify an edit. It does not reach backwards.

QuestionAnswer
Is a document already held still blocked?Yes. The confirm, receipt, invoice, print and emit gates deliberately do not consult the toggle. A held PO stays unconfirmable.
Is its approval still raised?Yes, by every route - a confirmation attempt, Retry from the exception workbench, and both scheduled drain batches, which run regardless of the toggle.

This is deliberate and follows one rule: raise the owed approval with the feature off if and only if the document is still actually blocked with the feature off. Where it stays blocked, refusing to raise the approval would strand it - you would switch off a feature and silently acquire an order nobody can ever confirm.


7. Screens involved, in order of use​

StepScreen
Author the policyGuard control policies
Check what it would do firstPolicy simulation results
Confirm the policy can actually fireWarden setup gaps
See what is held right nowGovernance holds
See the captured changesChange diff sets
ApproveWork items assigned to me (diff FactBox), consolidated diff panel
Settle a band disputeField approval baselines
See what happened, per documentGovernance event log (opened from the document)
See what happened, company-wideGovernance event log (opened from the menu)
When Warden itself failsExecution exceptions

8. Notes for implementation consultants​

  • Configure the field change matrix before activating anything. A blocking policy that classifies no high-risk fields is Active and cannot do what it claims. Warden setup gaps lists exactly this.
  • Simulate before activating. The activator is meant to review evidence before approving, and the simulation persists its runs for that reason. Read the CoverageNote - it states what the simulation does and does not model. It covers guard control, journal governance and price guard policies; sales governance and count governance policies are not simulated.
  • Author ≠ activator is enforced, not advisory. The controls owner cannot activate a policy they authored. If a link on the Controls workspace will not open for them, that is the control working.
  • Schedule the drains. Without the delta route drain, an edited-then-abandoned document sits held with no work item to release it. That is a real deadlock, not a tidiness concern.