> ## Documentation Index
> Fetch the complete documentation index at: https://developer.fabric.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Reallocation and Cancellation Rules

fabric's Reallocation interface enables dynamic reallocation of orders based on customizable business rules. This feature is designed to improve operational efficiency, reduce manual intervention, and ensure optimal fulfillment outcomes by reacting intelligently to real-world disruptions.

## Key Capabilities

**Automated Rule Execution**: You can define a ruleset composed of multiple conditional rules. When the system detects a match between an order event and a rule’s condition such as a reason code, it automatically executes the corresponding action.

**Flexible Action Framework**: Actions triggered by rules can include:

* Reallocating an order to a different fulfillment location.
* Updating inventory quantities at a specific location (For example, marking items as damaged or unavailable).
* Flagging a location for a temporary outage, removing it from allocation eligibility based on predefined triggers such as weather events or system issues.

<Note> Rules are evaluated in top-down order. Only one active ruleset can exist at a time to ensure clarity and predictability in execution. </Note>

## Prerequisites

* Ensure you have the **Orders & Inventory Editor** or **Administrator** privilege for fabric Orders. For more information, see [Role-Based Access Control](../../settings/rbac/role-based-access-control-orders-roles.mdx).

## Condition fields

| Field         | Description                                                                                                                                                                                                                             |
| :------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Scope**     | Scope determines the attribute schema used to fulfill the condition.                                                                                                                                                                    |
| **Attribute** | The **Attribute** dropdown is populated based on the selected scope.                                                                                                                                                                    |
| **Operator**  | A list of supported expressions. Each operator filters data in a different way.                                                                                                                                                         |
| **Value**     | The value of an attribute. For example, an online order can have the attribute `itemsType` with a value equal to `WEB_SHIP`. Another example is the attribute `reasonCode` with a value equal to `1DMG`. Multiple values are supported. |

## Action fields

| Field                            | Description                                                                                                                                                              |
| :------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**                       | Specifies the action to execute when a rule’s condition is met. Options include **Reallocation** or **Cancellation** of the order.                                       |
| **Configure Inventory No Stock** | If set to **Yes**, the allocated inventory for the item is removed from the fulfillment location’s available stock.                                                      |
| **Configure Location Outage**    | If set to **Yes**, the location is temporarily disabled from receiving future order allocations. You must reset the location's availability for it to be eligible again. |
| **Includes Previous Location**   | If set to **Yes**, the original fulfillment location remains eligible as a candidate during reallocation.                                                                |

## Example Use Case

### Weather events

An order is allocated to a fulfillment center. Before the order is picked, a weather-related delay is reported in that region, and the associate or system logs a reason code indicating "Severe Weather." The reallocation engine evaluates this event and matches it to a rule configured for that condition. As a result, the system takes the following actions:

1. Flags the affected location as temporarily unavailable, preventing future allocations until the outage is cleared.

2. Reallocates the impacted order to an alternate fulfillment center that can meet the service level requirements.

3. fabric's alert system optionally notifies operations or inventory teams about the automated outage trigger and reallocation event.

This automated response helps maintain continuity of service during disruptions and reduces the burden on operational teams to intervene manually.

### Damaged items

An order is allocated to a warehouse. During the picking phase, the associate discovers that an item is damaged and marks it accordingly in the system. The reallocation interface evaluates this event and identifies a rule that matches the condition (reason code = "Damaged"). The system then:

1. Removes the damaged item from the warehouse’s available inventory.

2. Checks inventory availability at the same location. If no additional units of the item are available, the system either:

   * Reallocates the order to another fulfillment location that has stock, or
   * Cancels the order if no alternative source is available.

3. Optionally, if the warehouse operates on a daily fulfillment cycle, the system may reallocate the item to the same location, queuing it for the next shift or shipping day when inventory or capacity is expected to be refreshed.

4. Updates fulfillment status accordingly and logs the reallocation for audit and visibility.

This process ensures continued fulfillment without manual review, reducing delays, and improving customer satisfaction.

## Process

Before creating your first rule set, make sure to configure all relevant reason codes. These codes are essential for determining the appropriate action when allocation or cancellation conditions are triggered.

### Creating reason codes

1. Using the left navigation, click **Orders** > **Configurations** > **Reallocation**.

   The **Reallocation** page is displayed.

2. Click the **Reason Codes** tab.

   A table displaying all your reason codes is displayed.

3. Click **Add Reason Code**.

   The **Add Reason Codes** window is displayed.

4. In the **Code** field, enter the reason code.

   The code field will map to the value field for your rules.

5. In the **Description** field, optionally provide a brief description of the code.

6. In the **Uses** field, select where the reason code can be used.

7. Click **Save**.

The reason code is saved and added to the table.

### Creating a new rule set

<Note>  If you haven’t set up all your reason codes yet, you’ll need to do so first. Reason codes define what action should be taken when a specific allocation or cancellation scenario occurs. </Note>

1. Using the left navigation, click **Orders** > **Configurations** > **Reallocation**.

   The **Reallocation** page is displayed.

2. Click **Add Rule**.

   The **Rule Set Reallocation** interface is displayed in an **Inactive** state.

3. In the **Allocation** field, click **Add condition**.

   This first condition is used to determine what kind of allocation occurred. For example, if the allocation was a *WEB\_SHIP* or *STORE\_PICKUP*, different reason codes may exist.

4. Enter the following details:
   * In the **Attribute** field, select an attribute.
   * In the **Operator** field, select an operator.
   * In the **Value** field, enter a value.

5. In the **Allocation Items** field, click **Add condition**.

   The second condition for this rule is set at the item level. This condition will contain an attribute such as `reasonCode`.

6. Enter the following details:
   * In the **Attribute** field, select an attribute.
   * In the **Operator** field, select an operator.
   * In the **Value** field, enter a value.

7. In the **Action** field, select an [action](#action-fields).

   The **Cancellation** action doesn't have the **Includes Previous Location** option available.

8. Configure the action fields. For more information on what each field does, review the [action fields table](#action-fields).

You can repeat this process to create a rule for each reason code instance and even have different reallocation rules set up for different item types.

* To rename a rule you previously created, hover over the rules name and click the edit icon on the right.

* To delete a rule, hover over the rules name and click the delete icon on the right.

Once you have created all your rules, do the following:

1. Click **Save As New Version**.

   The **Save as a New Version** window is displayed.

2. In the **Version Name** field, enter a new name.

3. In the **Description** field, optionally enter a description.

4. Use the **Version Status** toggle to set the new rule set as **Active**.

   By default this is set to **Inactive**.

5. Click **Save Version**.

The rule set is saved.

### Viewing rulesets and versions

1. Using the left navigation, click **Orders** > **Configurations** > **Reallocation**.

   The **Reallocation** page is displayed.

2. Click **Version History**.

   The **Rule Version History** window is displayed. Here you can search and view all your previous rule versions. By default, the currently active ruleset is displayed at the top.

3. Click a ruleset's name to view its details.

### Setting a ruleset as active

1. Using the left navigation, click **Orders** > **Configurations** > **Reallocation**.

   The **Reallocation** page is displayed.

2. Click **More Actions**.

3. Click **Activate**.

The selected ruleset is set to **Active**.
