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.
Scores and Weights
A weight is assigned to a rule. A score is assigned to a location. There are three ways scores are calculated.
- Scores can be static, which means if a location matches it, it’s awarded the full score.
- Scores can be linear, which means the higher a location’s value is for a field, the higher it scores.
- Scores can be inverse linear, which means the lower a location’s value is for a field, the higher it scores.
Each rule’s weight is divided by the sum of the rule weights, so that each rule has a percent value and all percent values add up to 100%. The score of each location is multiplied by its rule’s weight percentage and the location with the highest value is selected.
For example, a rule group has three weighted rules:
- Cost of Processing
- Quantity on Hand
- State
The weights and scores of each of these rules are as follows:
- Cost of Processing has a weight of 2,000 with inverse linear scoring. The score ranges
from 0 to 100, where 0 is awarded to any location that costs more than 25 dollars to
process an item and 100 is awarded to any location that’s free to process. The scores for
numbers in between are prorated so that the cheaper the processing, the higher the score.
- LosAngelesLocation has a score of 75
- SeattleLocation has a score of 50
- SanFranciscoLocation has a score of 45
- Quantity on Hand has a weight of 1,000 with linear scoring. The score ranges from 0 to
200, where a 0 is awarded to any location with less than 100 quantity on hand and 200 is
awarded to any location with more than 500 quantity on hand. The scores for numbers in
between are prorated so that the higher the quantity, the higher the score.
- LosAngelesLocation has a score of 55
- SeattleLocation has a score of 60
- SanFranciscoLocation has a score of 89
- State has a weight of 500 with static scoring. The condition awards 50 points to any
states that are not California, due to an issue with shipping within the state.
- LosAngelesLocation has a score of 0
- SeattleLocation has a score of 50
- SanFranciscoLocation has a score of 0
The percents are calculated by adding the weights (3,500) and then dividing each weight by that sum. These numbers are rounded.
- Cost of processing has a percent of 57%
- Quantity on hand has a percent of 29%
- State has a percent of 14%
Now the scores are calculated against each percent.
- Cost of Processing
- LosAngelesLocation: 75 multiplied by 57% equals 42.75
- SeattleLocation: 50 multiplied by 57% equals 28.5
- SanFranciscoLocation: 45 multiplied by 57% equals 25.65
- Quantity on Hand
- LosAngelesLocation: 55 multiplied by 29% equals 15.95
- SeattleLocation: 60 multiplied by 29% equals 17.40
- SanFranciscoLocation: 89 multiplied by 29% equals 25.81
- State
- LosAngelesLocation: 0 multiplied by 14% equals 0
- SeattleLocation: 50 multiplied by 14% equals 7
- SanFranciscoLocation: 0 multiplied by 14% equals 0
Finally, the scores are added up.
- LosAngelesLocation: 42.75+15.95+0= 58.70
- SeattleLocation: 28.5+17.40+7=52.90
- SanFranciscoLocation: 25.65+25.81+0=51.46
LosAngelesLocation is selected because it has the highest total score. The processing cost rule was weighted so highly that even though it had less quantity on hand and was in the state of California, it won out over the other two locations.
Here is the same example in table form, to illustrate how the scores are calculated.
Cost of Processing
| Location | Score | Rule Weight | Score*Weight | |
|---|---|---|---|---|
| LosAngeles | 75 | 57% | 42.75 | |
| Seattle | 50 | 57% | 28.5 | |
| SanFrancisco | 45 | 57% | 25.65 |
Quantity on Hand
| Location | Score | Rule Weight | Score*Weight | |
|---|---|---|---|---|
| LosAngeles | 55 | 29% | 15.95 | |
| Seattle | 60 | 29% | 17.40 | |
| SanFrancisco | 89 | 29% | 25.81 |
State
| Location | Score | Rule Weight | Score*Weight | |
|---|---|---|---|---|
| LosAngeles | 0 | 14% | 0 | |
| Seattle | 50 | 14% | 7 | |
| SanFrancisco | 0 | 14% | 0 |
| Location | Cost of Processing Weighted Score | Quantity on Hand Weighted Score | State Weighted Score | Total Score |
|---|---|---|---|---|
| LosAngeles | 42.75 | 15.95 | 0 | 58.70 |
| Seattle | 28.5 | 17.40 | 7 | 52.90 |
| SanFrancisco | 25.65 | 25.81 | 0 | 51.46 |