Automatic Order Validation

Djust OMS supports automatic validation of draft or on-hold orders through a scheduled background job, configured via the Djust Data Hub. This feature allows delayed or programmatic progression of orders from Draft or On Hold to Created status, based on a configured validation date.


⚙️ How It Works

A recurring job in the Data Hub automatically scans eligible orders and validates them when the conditions below are met.

🔄 Job Behavior

  • The job runs at regular intervals (e.g., every 15 minutes).
  • It looks for orders currently in status Draft or On Hold.
  • For each order, it checks for a custom field of typeDATE linked to the role Automatic order validation date.

📅 Custom Field Requirement

To be eligible for automatic validation, an order must include a DATE custom field associated with the following role:

🗒️

Configuration of order custom field role :

Role: Automatic order validation date
Location: https://your.tenant.name.djust-app.com/settings/custom-field-roles

Only one custom field with this role should be assigned per tenant. The field must be of type DATE.


🕒 Validation Criteria

When the job runs, it attempts to validate an order if:

  • The associated custom field contains a date equal to or earlier than the current job execution timestamp.

If this condition is met, the order is automatically transitioned toCreated.


❗ Validation Errors & Controls

Before updating the order status, the job performs standard order validation checks (e.g., completeness, pricing integrity, delivery options, etc.).

If an error occurs during validation:

  • By default, the order remains in its current state.
  • The error is logged and can be reviewed by the operations team.

🛠️ Feature Flag: CONTROLLED_AUTOMATIC_ORDER_VALIDATION

To override standard validation behavior, a feature flag is available:

  • If CONTROLLED_AUTOMATIC_ORDER_VALIDATION is set to false:
    • The job skips validation checks.
    • Orders with a valid date are forcibly transitioned to Created, even if inconsistent.
⚠️

This setting should only be used with caution in controlled environments.


🧩 Example Flow

flowchart TD
    A[Order in Draft or On Hold] --> B[Has DATE custom field with validation role?]
    B -- No --> Z[Skip]
    B -- Yes --> C[Date <= Now?]
    C -- No --> Z
    C -- Yes --> D[Attempt validation]
    D --> E{Validation successful?}
    E -- Yes --> F[Set status to Created]
    E -- No --> G{Feature flag OFF?}
    G -- No --> H[Keep order as-is, log error]
    G -- Yes --> F

🔧 Configuration Summary

ElementValue / Location
Custom field roleAutomatic order validation date configured in Backoffice config path /settings/custom-field-roles
Allowed custom field typeDATE
Validation job frequencyConfigured in Data Hub
Feature flag (bypass checks)CONTROLLED_AUTOMATIC_ORDER_VALIDATION (Boolean)