---
schema_version: "1"
id: 32ace548c7956e3567f1f5ba73b053d1a214cd3fb4454164a07702ef9ce9ac0a
title: Create a Custom Routing Rule
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/commerce/264-0-0/om_new_custom_rule.md
canonical_url: https://help.salesforce.com/s/articleView?id=commerce.om_new_custom_rule.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: d81af36974f31ae8aad050ac25bcc637907b061fb36553cbae787a58ccff2532
description: Custom rules modify routing by selecting locations based on any standard or custom attribute available on Order Management objects. Custom rules can filter out locations or select an ideal location by calculating condition-based scores.
products:
  - Commerce
  - Salesforce Order Management
release: "264"
---
# Create a Custom Routing Rule

Custom rules modify routing by selecting locations based on any standard or custom attribute available on Order Management objects. Custom rules can filter out locations or select an ideal location by calculating condition-based scores.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=commerce.om_editions.htm&amp;language=en_US" target="_blank">View supported editions</a>.</td></tr></tbody></table>

Before beginning this task, make sure the [Order Fulfillment Setup section](https://help.salesforce.com/s/articleView?id=commerce.om_enable_order_management_setup.htm&release=264.0.0&type=5 "The Order Fulfillment Setup section is the landing page for all components of Commerce Delivery Service (CDS).") is enabled. Then, make sure you’ve [created at least one rule group](https://help.salesforce.com/s/articleView?id=commerce.om_new_rule_group.htm&release=264.0.0&type=5 "Control Order Management routing by creating and publishing groups of templated or custom rules.").

1. In the Rule Management tab of Order Fulfillment Setup, find and expand your rule group as needed. You can’t add a rule to a published rule group.
2. In the group’s action menu, click **New Rule**.
3. Name your rule.
4. Select a rule type. A filter type directly excludes locations. A weighted type considers all rule weights and selects the best location.
5. For a weighted rule, set the weight.
    
    The weight is a number from 0 through 10,000 and is considered alongside each location’s score. The algorithm determines the best location based on a rule’s importance and how well a location fits the rule’s conditions.
6. Optionally, enter a start and end date and time.
7. Configure your rule’s conditions.
    
    Conditions for filter rules exclude locations. Conditions for weighted rules determine how each location is scored.
    
    1. Set the condition logic. A rule can require all conditions, any condition, or a custom logic to be met.
    2. Select an object and a field on that object.
    3. Set an operator and enter a value for the field.
8. For a weighted rule, select how locations are scored. The score is a number from 0 through 100. <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
          <tbody><tr class="">
            <th style="vertical-align:top;" headers="d12589e145-option" id="d12589e149">Static</th>

            <td style="vertical-align:top;" headers="d12589e145-desc d12589e149">
              <p>Add a score to your rule.</p>
              <p>If the rule's conditions apply to a location, that location gets this static score. Higher
                scores are favored more during routing.</p>
            </td>

          </tr>
          <tr class="">
            <th style="vertical-align:top;" headers="d12589e145-option" id="d12589e164">Linear</th>

            <td style="vertical-align:top;" headers="d12589e145-desc d12589e164">
              <p>Select an object and a field on that object. Then set a maximum and minimum score. </p>
              <p>If the rule's conditions apply to a location, that location gets a dynamic score that
                increases based on how well it matches the rule. Higher scores are prioritized during
                routing.</p>
              <p>Linear scoring is useful when a high number is favored, such as for product inventory.</p>
            </td>

          </tr>
          <tr class="">
            <th style="vertical-align:top;" headers="d12589e145-option" id="d12589e182">Linear Inverse</th>

            <td style="vertical-align:top;" headers="d12589e145-desc d12589e182">
              <p>Select an object and a field on that object. Then set a maximum and minimum score. </p>
              <p>If the rule's conditions apply to a location, that location gets a dynamic score that
                decreases based on how well it matches the rule. Higher scores are prioritized during
                routing.</p>
              <p>Linear inverse scoring is useful when a low number is favored, such as for shipping
                distance or cost.</p>
            </td>

          </tr>
        </tbody></table>
9. Click **Save**.

- **[Custom Weighted Routing Rules](https://help.salesforce.com/s/articleView?id=commerce.om_custom_weighted_rule.htm&release=264.0.0&type=5)**  
    A custom weighted routing rule provides a greatly expanded level of freedom when it comes to creating a rule. You can create a rule based on any standard or custom attribute available on Order Management objects. An attribute’s value or existance creates the condition for your rule, and the score and weight of each attribute and rule determine which locations get selected.

#### See Also

- [Routing via Rules](https://help.salesforce.com/s/articleView?id=commerce.om_routing_rules_overview.htm&release=264.0.0&type=5 "Use rule groups to modify routing logic directly in the Order Management UI instead of using code or Salesforce Flow.")
- [Customize Routing Logic with Rule Groups](https://help.salesforce.com/s/articleView?id=commerce.om_new_rule_group.htm&release=264.0.0&type=5 "Control Order Management routing by creating and publishing groups of templated or custom rules.")
- [Custom Weighted Routing Rules](https://help.salesforce.com/s/articleView?id=commerce.om_custom_weighted_rule.htm&release=264.0.0&type=5 "A custom weighted routing rule provides a greatly expanded level of freedom when it comes to creating a rule. You can create a rule based on any standard or custom attribute available on Order Management objects. An attribute’s value or existance creates the condition for your rule, and the score and weight of each attribute and rule determine which locations get selected.")