xMatix
Sign in Request demo
xMatix
PRODUCTS
SalesField SalesCRMRewardsClaimsInventoryProcurementWarehouse ManagementField ServiceServiceSupportTelephony & MessagingFinance & AccountingPayrollExpense ManagementCommercePortalsAnalytics & ReportingData StudioMobile AppSee all products →
PLATFORM
Platform overviewApp BuilderAutomationIntegrationsSecurity & GovernanceChange ManagementDevelopers
SENSE AI
Sense AI overviewSense AssistSense ControlSense VisionAI StudioTrust & governanceIn Claude & ChatGPTUse cases
SOLUTIONS
FMCG & DistributionManufacturing & Dealer NetworksAutomotive & DealershipsPharma & HealthcareConsumer DurablesAgri-InputsBuilding MaterialsService NetworksWarehousing & 3PLFinancial AccountingERP SoftwareIndia GST ComplianceUAE VAT & e-InvoicingSaudi ZATCA & VATAll solutions →
RESOURCES
Knowledge CenterDeveloper & CLIBlogGuidesWhat is xMatix?Company facts
COMPANY
AboutCareersPartnersEventsContactAuthorsLegal
Sign in Request demo
Home/Docs/Platform Concepts/What runs when you save a record
CONCEPT · Last reviewed

What runs when you save a record

Read the entity Execution Plan

Order entity Execution Plan under Design Studio → Entities → Order → Logic: header badges (Compiled storage, Plan complete, 35 steps across 7 phases, 6 unsequenced, 1 slots unordered), the Insert/Update/Delete/All ladder switch, and the numbered phases Load Defaults, Before Insert · Normalise and Before Insert · Validate expanded to show sequence slots -1000, 0 and 1 with platform steps and four business rules sharing slot 1
The entity Execution Plan merges every participating surface — platform handlers, business rules, workflows, scripts — into the actual phase and sequence ladder for one operation, so 'what runs when this record is saved' is read from the plan, not guessed.UI captured
  1. 1

    Storage kind, Plan complete, step and phase counts, and the unsequenced / unordered warnings tell you whether the ladder can be trusted as exhaustive before you read it.

  2. 2

    Ladder for Insert, Update, Delete or All — diagnose one operation at a time; the other operations act on different records and cannot contend with it.

  3. 3

    Each numbered phase states whether it can block the save and how many steps it holds; Before Insert · Validate is where metadata rules, business rules and blocking scripts land.

  4. 4

    A sequence slot is the cross-surface ordering unit — the four business rules in slot 1 run as one engine call, where StopOnFalse and SetValue priority are resolved together.

  5. 5

    Per-step badges show the sequence origin (no sequence set = the surface's default slot), whether it runs inline, and whether a failure blocks or continues.

  6. 6

    Recent runs shows what actually executed on real saves; the plan shows what is configured to run.

The Execution Plan (Setup → Design Studio → Entities → the entity → Logic → Execution Plan) is the implementation-backed answer to “what runs when this record is saved?” The example shows the Order entity with the Insert ladder selected. The header confirms whether the plan is complete, identifies compiled or custom storage, counts steps and phases, and warns about unsequenced or unordered work. Each numbered phase then places platform handlers, business rules, workflows and scripts on the sequence slots they occupy, and every step carries badges for its sequence origin, inline execution and whether a failure blocks or continues.

Always choose the operation you are diagnosing—Insert, Update, Delete or All—before reading the ladder. Expand the affected phase, inspect every step in its slot, and treat warning badges as part of the contract. Recent runs answers what happened on actual saves; the plan answers what is configured to happen.

xMatix does not run each customization surface as one isolated global stage. It uses shared lifecycle phases, and the configured steps from several surfaces can appear together inside a phase. The Execution Plan is therefore more reliable than a memorized rule such as “all business rules run before all scripts.”

The lifecycle phases

PhasePurposeCan it prevent the operation?
Load DefaultsInsert-only audit stamps, defaults, numbering and other initial valuesNo; it prepares a new row before validation
PreValidateInsert/update normalization that must happen before metadata validationNo; failures are treated as non-blocking by this phase
ValidateMetadata validation, blocking business rules, validation scripts and workflow steps mapped to validationYes
Before SaveIn-transaction work immediately before an insert or update is writtenYes
Before DeleteDelete-specific in-transaction checks and effectsYes
After SaveWork after the row is written while the enclosing transaction may still be openYes; a propagated failure can still roll back the save
After DeleteDelete-specific post-write work while the transaction may still be openYes for the same transactional reason
PostCommitSaved triggers, post-save rule actions and deferred workflow/integration work after commitNo; the record is already committed
OnFailureCompensation and failure observers when the save itself failedIt reacts to the failure rather than deciding the original save

Not every operation uses every phase. Load Defaults is insert-only; delete uses its delete-specific phases; PostCommit runs only after a successful commit; OnFailure appears only on failure. Select All when comparing ladders, not when trying to answer the order for one concrete save.

Sequence slots are shared within a phase

Within one phase, steps are ordered on a shared numeric sequence line. An explicitly sequenced script, workflow or other supported step can therefore be placed relative to a step from another surface in that same phase. A sequence does not move work into a different phase: a Validate step cannot be sequenced into PostCommit.

Three details matter:

  • Unsequenced means the artifact uses its surface's default slot. Make the sequence explicit when another step must reliably run before or after it.
  • Shared slot means multiple steps have the same effective sequence. Some, such as business rules sharing a slot, deliberately run as one engine call so StopOnFalse and SetValue priority can be resolved together. Other slots may be marked unordered, meaning their relative order is not defined.
  • Sequence not enforced means the plan can display the requested position but the current runtime path does not honor it. Treat that badge as a release blocker for any dependency on the shown order.

Business-rule Sequence positions a rule's slot on this cross-surface line where runtime support is active. Rules within the same slot are evaluated together; their Order supplies the intra-slot order and Priority resolves competing SetValue actions on the same field. Those fields are not interchangeable.

Platform logic, workflows, approvals and scripts

First-party module behavior is represented as platform or C# handler steps in the same phases. This is where sales, inventory, finance and other feature validation or derivation appears; it is not a single opaque “module logic after rules” stage.

Workflows and automation scripts are mapped to the phase configured for their binding. A validation-phase step can block; a PostCommit continuation cannot undo the committed row. Asynchronous steps can finish later, so never make the next synchronous save step depend on their completion.

Approval is not an automatic universal phase that every eligible save enters. A record reaches approval only through a configured entry point—for example a Request Approval rule action, an explicit record action, a workflow or feature-specific handler. Inspect that entry artifact and the entity's Approval Processes alongside the Execution Plan.

Diagnose a blocked save or changed value

  1. Open Design Studio → Entities, select the exact entity, expand Logic, and open Execution Plan.
  2. Select Insert, Update or Delete to match the failed operation.
  3. Confirm Plan complete. If a source is unavailable, fix that visibility problem before assuming the ladder is exhaustive.
  4. Expand the phase named by the error or trace. If none is named, start at Validate for a rejected save and work forward for an unexpected value.
  5. Read slots from lowest to highest sequence. Inspect every artifact in a shared slot and every warning badge.
  6. For a value change, identify each writer and find the last successfully executed in-transaction writer. PostCommit work can create later effects, but it cannot rewrite the already committed transaction without starting a separate operation.
  7. Open Recent runs and match the entity, operation and timestamp. Compare observed steps with the plan before changing configuration.
  8. Test the smallest safe change with both a passing and failing record, then restore the intended sequence documentation.

Common questions

A business rule and a script both set the same field—which wins?

There is no safe category-wide answer. Compare their lifecycle phase, effective sequence and slot behavior in the entity's Execution Plan. A later in-transaction writer normally supplies the stored value, unless an earlier step blocks the save or the steps share an engine slot whose own priority rules decide the conflict.

Can I put a script before a business rule?

Yes only when both map to the same lifecycle phase and their runtime paths enforce the configured sequence. Set explicit sequences, then verify the plan shows the intended slots without a sequence not enforced or unordered warning. A sequence cannot cross phase boundaries.

Can After Save fail the save?

Yes. The row may have been written to the database context, but the enclosing transaction can still be open. A propagated After Save or After Delete failure can roll the transaction back. Only PostCommit is definitively too late to block the committed operation.

Does every qualifying record enter approval automatically?

No. Approval requires a configured entry action or feature path. The process definition describes what happens after entry; it does not by itself submit every record that happens to match its entity.