Fluent Commerce Logo
Docs

CreateFulfilmentWithSourcingProfile

Rule

Changed on:

27 Aug 2026

Overview

Create Fulfillment(s) using the specified Sourcing Profile.
Plugin NameOrder Reference Module
Namespace[[account.id]].order
The Order Reference Module is the foundation for order-related implementations. It provides reference workflows for click & collect, home delivery and mixed baskets and those needed to build your own. Extensible by design, use this Module as a base to build a solution to your customers' needs.

UI Description

Apply the Sourcing Profile identified by {sourcingProfileRef} to a Sourcing Request (Order, Fulfillment Option, etc.) and produce Fulfillment(s).

Accepts

  • ORDER
  • FULFILMENT_CHOICE

Actions

Rule parameters

NameTypeDescription
`sourcingProfileRef``String`Reference to the Sourcing Profile to apply.

Event attributes

This Rule does not expect any Event attributes.

Exceptions

  • This Rule throws a `PropertyNotFoundException` when the Rule parameter(s) is not provided.
  • This Rule throws an `IllegalArgumentException` if Sourcing Conditions or Criteria are improperly configured

Configuration example

1{
2  "name": "[[account.id]].order.CreateFulfilmentWithSourcingProfile",
3  "props": {
4    "sourcingProfileRef": "GLOBAL_DEFAULT"
5  }
6}

Detailed Technical Description

This Rule executes the following steps:1. Validate the `sourcingProfileRef` parameter.2. Load the Sourcing Profile using the provided reference (`SourcingUtils.loadSourcingProfile`).3. Verify that the Sourcing Profile contains at least one Primary Sourcing Strategy.4. Load the Sourcing Context and identify Unfulfilled Items (`SourcingContextUtils.loadSourcingContext`).5. Iterate over the Primary Sourcing Strategies in `priority` order (`SourcingUtils.getPlanFinder().nextFullPlan()`).
For each Strategy:
  • Confirm that the Strategy `status` is `ACTIVE`
  • Evaluate the Sourcing Conditions against the current Sourcing Request (skip the Strategy if its Conditions are not met)
  • Load Locations for the Strategy Network and rank them using the ATS-Agnostic Sourcing Criteria
  • Evaluate Locations using a `ChunkLoadingPlanFinder` that loads Locations and Virtual Positions (`SourcingUtils.loadPositions`) in incremental chunks sized proportionally to the order's item count. Virtual Positions with status `ACTIVE`, `AT_RISK`, and `OUT_OF_STOCK` are included. A single-location search is run after each chunk. A multi-split search is run across the full evaluated set if no single-location plan is found (`SourcingUtils.findPlanForAllItems`):
    • Before entering permutation search, an early availability check sums available quantities for each required item across all candidate Locations. If any item cannot be covered, permutation search is skipped
  • If the Plan is fully sourced → stop and return it
  • If not → continue to the next Strategy
  • If no Strategy produces a fully sourced Plan → return an empty Sourcing Plan
6. Confirm that the resulting Sourcing Plan contains Fulfillment(s).7. Set the fulfillment type for each Fulfillment based on Fulfillment Choice and Location (`OrderUtils.fillFulfilmentType`).8. Create the Fulfillment(s) (`OrderUtils.createFulfilments`).9. Capture the Sourcing Audit for the completed Sourcing Request and submit it (`SourcingUtils.captureAudit``createSourcingAudit` mutation). 

Version History

2026-09-07

v26.9.7

Key Changes:
  • This rule now captures a Sourcing Audit of the completed Sourcing Request and submits it through the `createSourcingAudit` mutation
  • A failure to create the audit is logged and does not affect or reverse the sourcing outcome
2026-08-13

v26.8.13

Key Changes:
  • This rule now evaluates all eligible Locations via incremental chunk loading - a single-location search runs after each chunk, and a multi-split search runs across the full evaluated set if no single-location plan is found
  • An early availability check skips permutation search when the order cannot be fully sourced from the available stock
  • Virtual Positions with status `AT_RISK` and `OUT_OF_STOCK` are now included when loading Locations during sourcing 
  • Fulfillments are now assigned deterministic references to prevent duplication during concurrent re-sourcing
2025-09-29

v25.9.29

Initial release.