DOMRouting Package
DOMRouting Package
DOMRouting Package
Winter '22
Revised December 16, 2021
© Copyright 2000–2021 salesforce.com, inc. Salesforce is a registered trademark of salesforce.com, inc., as are other names and
marks. Other marks appearing herein may be trademarks of their respective owners.
Overview
Distributed Order Management Package Overview
What's Included
3
Distributed Order Management Package Overview
Prerequisites
4
Distributed Order Management Package Overview
How Does It Work?
5
Distributed Order Management Package Overview
Flowchart of Flows
6
Distributed Order Management Package Overview
Flowchart of Flows: Ingest Orders and Schedule Routing
7
Distributed Order Management Package Overview
Flowchart of Flows: Determine Routes for Orders to Ship
8
Distributed Order Management Package Overview
Flowchart of Flows: Create Fulfillment Orders for Unrouted Orders
9
Distributed Order Management Package Overview
Flowchart of Flows: Execute Routing of Orders for Shipping
10
Distributed Order Management Package Overview
Flowchart of Flows: Fulfillment Locations Fulfill Orders
11
Distributed Order Management Package Overview
Flowchart of Flows: Prep & Transfer Back Canceled Order Items for Rerouting
12
Distributed Order Management Package Overview
New in Winter '22: Routing Options
13
How to Access the DOM Flow Package
15
Custom Objects
For Handling Routing and Fulfillment Data
16
Custom Objects
For Handling Routing and Fulfillment Data
17
Custom Fields
Added to Standard Objects
18
Custom Fields
Added to Standard Objects
19
Sample Flows
Routing Flows
21
Routing Flows
22
Routing Step 1: Schedule Routing Flow
23
Flow:
Routing Step 1: Schedule Routing
Assume
BOPIS;
Location
Create
Fulfillment
Order
Check Each
Delivery
New Order Group's
Reservation
Location Type
Assume
Shipping;
Location
Create
Group
Routing
Schedule
24
Flow:
Routing Step 1: Schedule Routing
When does it run?
25
Flow:
Routing Step 1: Schedule Routing
1. Get Order Item Summaries
For each delivery group, it starts by getting all the data for the
group's items that represent products. (It'll deal with any
delivery charges later on.)
26
Flow:
Routing Step 1: Schedule Routing
2. Check Reserved At Data
The flow then loops through the products in the current
delivery group.
27
Flow:
Routing Step 1: Schedule Routing
3. Record Fulfillment Location or Location Group
If the flow already stored the current group's Reserved At
Location, it verifies that the current product's Reserved At
Location matches. If not, it creates a process exception and
errors out of the product-processing loop.
Note: How does the flow determine whether the record ID in the Reserved At
Location field references a location or a location group? It checks the first three
digits of the ID, which identify the object type -- for a location, that's 131. A pretty
neat trick!
29
Flow:
Routing Step 1: Schedule Routing
5. Add Shipping Delivery Group to Routing List
Once the flow finishes looping through the
products in the current delivery group, it checks
whether the Reserved At Location is a location or
a location group. If it's a location group, the flow
considers the delivery group to be for shipping
and adds it to a routing list, then moves to the
next delivery group in the order.
31
Flow:
Routing Step 1: Schedule Routing
7. Create BOPIS Fulfillment Orders
After the flow loops through all the delivery groups in the
order, it calls the Create Fulfillment Order invocable action
for each BOPIS fulfillment order input.
32
Flow:
Routing Step 1: Schedule Routing
8. Create Routing Schedules for Shipping Delivery Groups
Finally, the flow creates an order summary routing schedule for each delivery group in its
routing list. It sets the following values on each routing schedule:
● Status: SCHEDULED
● ScheduledDatetime: current DateTime
33
Routing Step 2: Determine Route by Splits
(Reminder: Choose and activate one of the two versions of this flow.)
This flow runs on each order summary routing schedule. It
gets the associated order delivery group and creates an
interaction order and interaction order items for it.
It determines the best fulfillment route based on minimizing
the number of splits.
Remember that this package adds a custom field to the Order
Summary Routing Schedule object that references an order
delivery group summary. A standard routing schedule isn't
associated with a specific delivery group.
34
Flow:
Routing Step 2: Determine Route by Splits
35
Flow:
Routing Step 2: Determine Route by Splits
When does it run?
36
Flow:
Routing Step 2: Determine Route by Splits
1. Get Order Delivery Group Data
First, the flow gets the order and order delivery group associated with the routing schedule.
Next, it'll determine which, if any, items in the delivery group need to be routed. The package
provides some custom fields on Order Item Summary to help with that.
37
Flow:
Routing Step 2: Determine Route by Splits
2. Identify Items to Route
The flow needs to identify any item quantities that haven't already been routed. This package
adds a couple of custom fields to Order Item Summary to help with that:
● IncompleteTransferQuantity__c: Quantity of the order item already included in
interaction order items, but not yet allocated to fulfillment orders
● AvailableToFulfillIncompleteTransferQty__c: QuantityOrdered - QuantityCanceled -
QuantityAllocated - IncompleteTransferQuantity__c
The flow traverses the delivery group and makes a routing list of order items with a nonzero
AvailableToFulfillIncompleteTransferQty__c field. If the list is empty, then the flow exits.
38
Flow:
Routing Step 2: Determine Route by Splits
3. Limit Processing Rate
After initializing some variables, the flow calls a
custom Apex action that protects it against data
overload. If the flow is trying to process too many
concurrent routing schedules, it can defer the
current routing schedule to be processed later.
39
Flow:
Routing Step 2: Determine Route by Splits
4a. Get Inventory Availability
The next step is to retrieve inventory
availability data for the items to be routed.
If the action call fails, and the failure limit hasn't been reached, the
routing schedule is rescheduled. Its new time is a number of hours in
the future equal to its number of action call failures plus one.
If the failure limit is reached, then the flow creates a process exception
using the fault response, sets the routing schedule's ScheduleStatus to
ABANDONED, and increments the order's RoutingAttempts.
This action uses a failure limit of 2. The flow abandons the routing
schedule if the action call fails a third time.
41
Flow:
Routing Step 2: Determine Route by Splits
4c. Get Inventory Availability
If the action call doesn't return any available inventory, then
the flow treats it the same as a failed action call. The only
difference is the text of the process exception Message.
42
Flow:
Routing Step 2: Determine Route by Splits
5a. Find Routes with Fewest Splits
The flow now builds an action input using the item quantities to be fulfilled and the
inventory availability responses. The action will use the availability data to determine the
routes, or sets of fulfillment locations, that can most efficiently handle the requested
quantities.
The flow sets the input's maximum number of splits to 2. You can think of a split as an
additional fulfillment location beyond the first. So a fulfillment route with 2 splits includes
3 locations. Thus, limiting routes to two splits tells the action to only return routes that
involve 3 or fewer fulfillment locations.
43
Flow:
Routing Step 2: Determine Route by Splits
5b. Find Routes with Fewest Splits
The flow then calls the Find Routes with Fewest Splits action.
If the action call fails, or doesn't return a valid response, then the flow
creates a process exception, sets the routing schedule's
ScheduleStatus to ABANDONED, and increments the order's
RoutingAttempts.
If the action call failed, the flow copies the fault response to the
process exception's Message field.
If the action ran, but didn't return a valid response, the flow records
that fact in the process exception's Message field.
44
Flow:
Routing Step 2: Determine Route by Splits
5c. Find Routes with Fewest Splits
If the action call doesn't return any routes, then the flow checks how
many routing attempts, both failed and successful, have been made for
the order summary associated with the current routing schedule.
If the routing attempt limit hasn't been reached, then the routing
schedule is rescheduled for one day in the future.
If the flow receives an empty Find Routes response after the fourth
routing attempt, then it treats the empty response the same as it treats
an invalid response, and abandons the routing schedule.
Be aware that the count includes attempts made for other routing
schedules associated with the same order summary!
45
Flow:
Routing Step 2: Determine Route by Splits
5d. Find Routes with Fewest Splits
If the action call returns more than one valid route, the response orders them by number
of splits, with the fewest splits first. So the flow just takes the first route from the response.
46
Flow:
Routing Step 2: Determine Route by Splits
6a. Create Interaction Orders
Next, the flow sets up inputs for creating the interaction orders. Because an interaction order
uses data from several different records, the flow calls a custom Apex action that helps
prepare the inputs.
47
Flow:
Routing Step 2: Determine Route by Splits
6b. Create Interaction Orders
The flow then loops through the locations in the selected route, creating an interaction order
input for each one. It sets the following values:
● Status__c: REQUESTED
● Type__c: TRANSFER_ROUTING
● Schedule__c: Current DateTime
48
Flow:
Routing Step 2: Determine Route by Splits
7a. Create Interaction Order Items
The next step is to create the interaction order items. To set up the
inputs, the flow loops through the locations in the route.
After incrementing the location counter, the flow gets the list of items
to route to the current location.
49
Flow:
Routing Step 2: Determine Route by Splits
7b. Create Interaction Order Items
The flow then loops through the interaction orders, using
the location counter to select the one in the same list
position.
For example, the first time through the loop, it selects the
first route location and the first interaction order. That first
interaction order handles the items being routed to that
first location. The second interaction order handles the
items going to the second location, and so on.
50
Flow:
Routing Step 2: Determine Route by Splits
7c. Create Interaction Order Items
Then the flow loops through the items being routed to the current location, building
inputs for them using the current target location and selected interaction order.
As with the interaction orders, it sets the Status__c to REQUESTED and the Type__c to
TRANSFER_ROUTING.
51
Flow:
Routing Step 2: Determine Route by Splits
7d. Create Interaction Order Items
After looping through the route's locations and preparing all the interaction order item
inputs, the flow creates them. Now everything's ready for the Routing Step 3: Execute
Routing flow.
Finally, it sets the routing schedule's ScheduleStatus to COMPLETED and increments the
number of routing attempts made for the original order summary.
Remember that a successful routing attempt counts toward the limit if a later routing
attempt for another part of the same order fails.
52
Routing Step 2: Determine Route by Splits and
Distance
(Reminder: Choose and activate one of the two versions of this flow.
This version is available in Winter '22 and later, and requires each
location to have a Visitor Address with a valid Country and Postal
Code.)
This flow runs on each order summary routing schedule. It
gets the associated order delivery group and creates an
interaction order and interaction order items for it.
It determines the best fulfillment route based on minimizing
the number of splits and the average delivery distance.
Remember that this package adds a custom field to the Order
Summary Routing Schedule object that references an order
delivery group summary. A standard routing schedule isn't
associated with a specific delivery group.
53
Flow: Routing Step 2:
Determine Route by Splits and Distance
Find Best
Fulfillment For each Route
Order Order Get Route Location:
Routing Delivery Inventory (Fewest Splits Create
Schedule Group Availability & Shortest Interaction
Average Order & Items
Distance)
54
Flow: Routing Step 2:
Determine Route by Splits and Distance
When does it run?
55
Flow: Routing Step 2:
Determine Route by Splits and Distance
1. Get Order Delivery Group Data
First, the flow gets the order and order delivery group associated with the routing schedule.
Next, it'll determine which, if any, items in the delivery group need to be routed. The package
provides some custom fields on Order Item Summary to help with that.
56
Flow: Routing Step 2:
Determine Route by Splits and Distance
2. Identify Items to Route
The flow needs to identify any item quantities that haven't already been routed. This package
adds a couple of custom fields to Order Item Summary to help with that:
● IncompleteTransferQuantity__c: Quantity of the order item already included in
interaction order items, but not yet allocated to fulfillment orders
● AvailableToFulfillIncompleteTransferQty__c: QuantityOrdered - QuantityCanceled -
QuantityAllocated - IncompleteTransferQuantity__c
The flow traverses the delivery group and makes a routing list of order items with a nonzero
AvailableToFulfillIncompleteTransferQty__c field. If the list is empty, then the flow exits.
57
Flow: Routing Step 2:
Determine Route by Splits and Distance
3. Limit Processing Rate
After initializing some variables, the flow calls a
custom Apex action that protects it against data
overload. If the flow is trying to process too many
concurrent routing schedules, it can defer the
current routing schedule to be processed later.
58
Flow: Routing Step 2:
Determine Route by Splits and Distance
4a. Get Inventory Availability
The next step is to retrieve inventory
availability data for the items to be routed.
If the action call fails, and the failure limit hasn't been reached, the
routing schedule is rescheduled. Its new time is a number of hours in
the future equal to its number of action call failures plus one.
If the failure limit is reached, then the flow creates a process exception
using the fault response, sets the routing schedule's ScheduleStatus to
ABANDONED, and increments the order's RoutingAttempts.
This action uses a failure limit of 2. The flow abandons the routing
schedule if the action call fails a third time.
60
Flow: Routing Step 2:
Determine Route by Splits and Distance
4c. Get Inventory Availability
If the action call doesn't return any available inventory, then
the flow treats it the same as a failed action call. The only
difference is the text of the process exception Message.
61
Flow: Routing Step 2:
Determine Route by Splits and Distance
5a. Find Routes with Fewest Splits
The flow now builds an action input using the item quantities to be fulfilled and the
inventory availability responses. The action will use the availability data to determine the
routes, or sets of fulfillment locations, that can most efficiently handle the requested
quantities.
The flow sets the input's maximum number of splits to 2. You can think of a split as an
additional fulfillment location beyond the first. So a fulfillment route with 2 splits includes
3 locations. Thus, limiting routes to two splits tells the action to only return routes that
involve 3 or fewer fulfillment locations.
62
Flow: Routing Step 2:
Determine Route by Splits and Distance
5b. Find Routes with Fewest Splits
The flow then calls the Find Routes with Fewest Splits action.
If the action call fails, or doesn't return a valid response, then the flow
creates a process exception, sets the routing schedule's
ScheduleStatus to ABANDONED, and increments the order's
RoutingAttempts.
If the action call failed, the flow copies the fault response to the
process exception's Message field.
If the action ran, but didn't return a valid response, the flow records
that fact in the process exception's Message field.
63
Flow: Routing Step 2:
Determine Route by Splits and Distance
5c. Find Routes with Fewest Splits
If the action call doesn't return any routes, then the flow checks how
many routing attempts, both failed and successful, have been made for
the order summary associated with the current routing schedule.
If the routing attempt limit hasn't been reached, then the routing
schedule is rescheduled for one day in the future.
If the flow receives an empty Find Routes response after the fourth
routing attempt, then it treats the empty response the same as it treats
an invalid response, and abandons the routing schedule.
Be aware that the count includes attempts made for other routing
schedules associated with the same order summary!
64
Flow: Routing Step 2:
Determine Route by Splits and Distance
6a. Find Route with Shortest Average Distance
Now, the flow compares all valid routes to find the one with the shortest average delivery
distance. For each route, it does the following:
1. For each fulfillment location in the route, calculate the distance to the recipient address in miles.
2. Calculate the average delivery distance by adding the distances and dividing the total by the
number of fulfillment locations in the route.
Then, it compares the average distances of all the routes and selects the route with the
shortest average.
The first step is to create an action input with the list of routes and the recipient address.
65
Flow: Routing Step 2:
Determine Route by Splits and Distance
6b. Find Route with Shortest Average Distance
The flow then calls the Rank Locations by Distance action.
If the action call fails, and the failure limit of two hasn't been reached,
the routing schedule is rescheduled. Its new time is a number of hours
in the future equal to its number of action call failures plus one.
If the action call fails for a third time, or if it succeeds but doesn't
return a valid response, then the flow creates a process exception with
an appropriate message, sets the routing schedule's ScheduleStatus to
ABANDONED, and increments the order's RoutingAttempts.
66
Flow: Routing Step 2:
Determine Route by Splits and Distance
6c. Find Route with Shortest Average Distance
If the Rank Locations action returns a valid response, the flow checks the number of
routes included in the response.
67
Flow: Routing Step 2:
Determine Route by Splits and Distance
6d. Find Route with Shortest Average Distance
If the Rank Locations action returns any valid routes, it
assigns them ranks based on the average distances
between each of the route's locations and the recipient
address.
68
Flow: Routing Step 2:
Determine Route by Splits and Distance
7a. Create Interaction Orders
Next, the flow sets up inputs for creating the interaction orders. Because an interaction order
uses data from several different records, the flow calls a custom Apex action that helps
prepare the inputs.
69
Flow: Routing Step 2:
Determine Route by Splits and Distance
7b. Create Interaction Orders
The flow then loops through the locations in the selected route, creating an interaction order
input for each one. It sets the following values:
● Status__c: REQUESTED
● Type__c: TRANSFER_ROUTING
● Schedule__c: Current DateTime
70
Flow: Routing Step 2:
Determine Route by Splits and Distance
8a. Create Interaction Order Items
The next step is to create the interaction order items. To set up the
inputs, the flow loops through the locations in the route.
After incrementing the location counter, the flow gets the list of items
to route to the current location.
71
Flow: Routing Step 2:
Determine Route by Splits and Distance
8b. Create Interaction Order Items
The flow then loops through the interaction orders, using
the location counter to select the one in the same list
position.
For example, the first time through the loop, it selects the
first route location and the first interaction order. That first
interaction order handles the items being routed to that
first location. The second interaction order handles the
items going to the second location, and so on.
72
Flow: Routing Step 2:
Determine Route by Splits and Distance
8c. Create Interaction Order Items
Then the flow loops through the items being routed to the current location, building
inputs for them using the current target location and selected interaction order.
As with the interaction orders, it sets the Status__c to REQUESTED and the Type__c to
TRANSFER_ROUTING.
73
Flow: Routing Step 2:
Determine Route by Splits and Distance
8d. Create Interaction Order Items
After looping through the route's locations and preparing all the interaction order item
inputs, the flow creates them. Now everything's ready for the Routing Step 3: Execute
Routing flow.
Finally, it sets the routing schedule's ScheduleStatus to COMPLETED and increments the
number of routing attempts made for the original order summary.
Remember that a successful routing attempt counts toward the limit if a later routing
attempt for another part of the same order fails.
74
Routing Step 3: Execute Routing Flow
75
Flow:
Routing Step 3: Execute Routing
Create
No
Fulfillment
Order
Transfer
Interaction
Inventory
Interaction Order
Reservations
Order from Associated
from
Routing with a
Location
Process Fulfillment
Groups to
Order?
Locations
Yes
76
Flow:
Routing Step 3: Execute Routing
When does it run?
77
Flow:
Routing Step 3: Execute Routing
1. Get Transfer Data for Interaction Order Items
First, the flow loops through the interaction order
items belonging to the interaction order.
78
Flow:
Routing Step 3: Execute Routing
2a. Transfer Inventory Reservations
The flow then passes the list of transfer inputs to the OCI Transfer Reservation invocable
action, along with these values:
● All or Nothing flag = true
● Priority = number of routing schedules associated with the original order summary
The All or Nothing flag tells the action to roll back all of the transfers if any of them fail.
79
Flow:
Routing Step 3: Execute Routing
2b. Transfer Inventory Reservations
If the action call fails, and the failure limit hasn't been reached,
the interaction order is rescheduled to be processed again in one
minute.
80
Flow:
Routing Step 3: Execute Routing
2c. Transfer Inventory Reservations
If the OCI Transfer Inventory action succeeds, but returns
any errors, the flow sets the interaction order's Status__c
to COMPLETED_FAIL and creates a new order summary
routing schedule.
81
Flow:
Routing Step 3: Execute Routing
3. Check for Fulfillment Order
After successfully transferring the inventory reservations from location groups to
locations, the flow checks whether the interaction order is associated with an
existing fulfillment order.
82
Flow:
Routing Step 3: Execute Routing
4. Prepare Fulfillment Order Inputs
The flow loops through the interaction
order's items and creates fulfillment
order input records for them.
83
Flow:
Routing Step 3: Execute Routing
5. Create Fulfillment Order
Finally, it's time to call the Create
Fulfillment Order invocable action.
Create
Ensure
Fulfillment Interaction
Funds and
Order with Fulfillment Create
Apply Them
Status Order & Invoice
to the
Fulfilled Items for
Invoice
Routing
85
Flow:
Create Invoice, Ensure Funds
When does it run?
86
Flow:
Create Invoice, Ensure Funds
1. Create Interaction Fulfillment Order
First, the flow creates an interaction fulfillment order for the fulfillment order, and sets these
values:
● Status__c: REQUESTED
● Type__c: FULFILLMENT
● Schedule__c: Current DateTime
Creating the record with the values REQUESTED and FULFILLMENT triggers the Fulfill
Reservation flow, and the Schedule__c tells that flow when to run. But this flow isn't done yet!
87
Flow:
Create Invoice, Ensure Funds
2. Create Interaction Fulfillment Order Items
The flow then creates an interaction fulfillment order item
for each fulfillment order line item in the fulfillment order
that represents a product.
88
Flow:
Create Invoice, Ensure Funds
3. Create Invoice
Next, the flow calls the Create Invoice invocable action for the
fulfillment order.
89
Flow:
Create Invoice, Ensure Funds
4. Check Invoice Balance
If the fulfillment order is for a reshipment, then the invoice has a zero balance, and the flow
doesn't need to ensure funds for it. So the flow checks the new invoice's balance.
If the balance is zero, then the flow is finished. Otherwise, it adds the invoice information to
an input for the Ensure Funds invocable action.
The action only requires the order summary and fulfillment order IDs as input, but the
fulfillment order ID must be wrapped in an Apex-defined input representation.
90
Flow:
Create Invoice, Ensure Funds
5. Ensure Funds
If the invoice has a balance, the flow calls the Ensure Funds
invocable action.
All that's left now is to fulfill the inventory reservations used for
this order. That's handled by the Fulfill Reservation flow, which this
flow already triggered by creating an interaction fulfillment order.
91
Fulfill Reservation Flow
Call OCI
Interaction Collect
Fulfill Update
Fulfillment Fulfillment
Reservation Records
Order Data
Action
92
Flow:
Fulfill Reservation
When does it run?
93
Flow:
Fulfill Reservation
1. Get Inventory Reservations
First, the flow traverses the interaction fulfillment order
items belonging to the interaction fulfillment order,
and retrieves their inventory reservation details.
To retrieve an item's SKU, it first looks up the
associated fulfillment order item, then uses that to find
the associated order item summary.
94
Flow:
Fulfill Reservation
1. Get Inventory Reservations (continued)
The flow builds an OCI Fulfill Reservation action input for each interaction fulfillment order
item using the following data:
95
Flow:
Fulfill Reservation
2. Call OCI Fulfill Reservation Action
If the flow retrieved any reservation data, it passes the inputs to the OCI Fulfill Reservation
invocable action.
96
Flow:
Fulfill Reservation
3a. Update Records (Action Failure)
If the action fails, the flow compares the current value of the
interaction fulfillment order's ConnectionFailedAttempts__c to
the flow variable MaxOCIConnectionFailAttempts (default value:
3), and does the following:
● If the number of failed attempts is less than the maximum,
increment ConnectionFailedAttempts__c
● If the number of failed attempts is equal to or greater than
the maximum:
○ Set the interaction fulfillment order's Status__c to
ABANDONED
○ Create a process exception for the associated order
summary, setting the Message field to "The number of
unsuccessful attempts to send transfer requests to
Omnichannel Inventory has reached the limit."
97
Flow:
Fulfill Reservation
3b. Update Records (Fulfillment Success)
If the action runs, and returns a success value of true, the flow sets the interaction fulfillment
order's Status__c to COMPLETED_SUCCEED.
98
Flow:
Fulfill Reservation
3c. Update Records (Fulfillment Failure)
If the action runs, but returns a success value of false, the flow
does the following:
● For each error property in the returns, create a process
exception for the associated order summary, copying the
Message field from the returned error property to the
process exception's Message field
● Set the interaction fulfillment order's Status__c to
COMPLETED_FAIL
99
Create Fulfillment Orders Screen Flow
No No
101
Screen Flow:
Create Fulfillment Orders
1. (User) Launch Flow
This flow is a screen flow, launched by a user from the UI. Before
you can use it, add it to the Actions & Recommendations
component of the Order Summary details page layout.
To run this flow, navigate to the details page for the order
summary that requires intervention, and launch the flow from the
Actions & Recommendations menu.
102
Screen Flow:
Create Fulfillment Orders
2. Retrieve Delivery Groups
The flow traverses the delivery groups, recording any that contain products to be fulfilled.
The next step depends on how many delivery groups are in need of fulfillment.
103
Screen Flow:
Create Fulfillment Orders
3. Select Delivery Group to Fulfill
If the flow only finds one delivery group to fulfill, it
skips the delivery group selection screen and
automatically selects the single delivery group for
fulfillment.
104
Screen Flow:
Create Fulfillment Orders
4. Select Products
Next, the flow retrieves the products and
delivery charges belonging to the selected
delivery group.
105
Screen Flow:
Create Fulfillment Orders
5. Retrieve Locations
On to stage 3, fulfillment location selection.
106
Screen Flow:
Create Fulfillment Orders
6. Select Fulfillment Locations
The flow then loops through the selected products and builds
a list of inputs it'll use later to create fulfillment order items for
them.
107
Screen Flow:
Create Fulfillment Orders
7. Decide Shipping Charge Inclusion
If the selected delivery group has any delivery charges, the flow presents stage 4, the include
delivery charges selection screen. In that case, the user selects whether to include the
shipping charges in the fulfillment order.
108
Screen Flow:
Create Fulfillment Orders
8a. Build Fulfillment Order Item Inputs
The flow uses a double loop through the selected items to group
them into fulfillment groups by location.
The outer loop starts by retrieving the current item's order item data
and checking whether it's already been added to a group. If not,
then it records the item's fulfillment location and heads into the
inner loop.
109
Screen Flow:
Create Fulfillment Orders
8b. Build Fulfillment Order Item Inputs
The inner loop checks each item's assigned location to see whether it matches the current
outer loop item's location. If so, it creates a fulfillment order item input for the inner loop
item, and adds the input to a list.
110
Screen Flow:
Create Fulfillment Orders
8c. Add Delivery Charges if Selected
When the inner loop adds the first input to a
list, it checks whether the user chose to include
delivery charges. If so, it adds inputs for the
delivery charge items to the list.
111
Screen Flow:
Create Fulfillment Orders
8d. Create Fulfillment Group Input
When the inner loop exits, the outer loop takes any fulfillment order item inputs it
produced and adds them to a fulfillment group input. Then it adds that input to a list.
112
Screen Flow:
Create Fulfillment Orders
9. Create Fulfillment Order
Finally, the flow is ready to create fulfillment orders and fulfillment order items. It passes
the list of fulfillment group inputs to the Create Fulfillment Order invocable action.
The default value of a fulfillment order's Source__c is NO_ROUTING. Since this flow
doesn't set the Source__c, the fulfillment orders it creates get picked up by the Schedule
Fulfillment Order Transfer flow.
If the action succeeds, the flow continues to stage 5: the confirmation screen, and a happy
Salesforce Order Management user!
113
Schedule Fulfillment Order Transfer Flow
Create
Allocated
Interaction
Fulfillment
Order &
Order Not from
Interaction
Routing Flows
Order Items
114
Flow:
Schedule Fulfillment Order Transfer
When does it run?
115
Flow:
Schedule Fulfillment Order Transfer
1. Get Transfer Data for Fulfillment Order Items
First, the flow loops through the fulfillment order
items belonging to the fulfillment order.
116
Flow:
Schedule Fulfillment Order Transfer
2. Create Input and Check for Reship
Next, the flow creates the interaction order input
with the values from the previous step and these
defaults:
● Schedule__c = Current DateTime
● Status__c = REQUESTED
● Type__c = TRANSFER_ROUTING
117
Flow:
Schedule Fulfillment Order Transfer
3. Create Interaction Order and Interaction Order Items
Next, the flow creates the interaction order.
Finally, the flow creates the interaction order items for the
interaction order, using the input list it set up earlier.
118
Create Inventory Reservation Flow
Interaction
Inventory
Order with
Reservations
Interaction
for Item
Order Items to
Reships
Be Reshipped
119
Flow:
Create Inventory Reservation Flow
When does it run?
120
Flow:
Create Inventory Reservation Flow
1. Get Reservation Data for Reship Items
First, the flow loops through the interaction
order items belonging to the interaction
order.
121
Flow:
Create Inventory Reservation Flow
2a. Create Inventory Reservations
Next, the flow passes the list of inputs to the Omnichannel
Inventory Service Create Reservation invocable action.
If the action call fails, and the failure limit hasn't been reached,
the interaction order is rescheduled to be processed again in
one hour.
122
Flow:
Create Inventory Reservation Flow
2b. Create Inventory Reservations
If the Create Reservation action call succeeds, but returns
any errors, the flow creates a process exception, sets the
interaction order's Status__c to COMPLETED_FAIL, and then
exits.
123
Flow:
Create Inventory Reservation Flow
3. Update Interaction Order Status
If the action succeeded with no errors, then this flow is done! It's created
reservations for the items being reshipped.
It finishes by setting the interaction order's Status__c to COMPLETED_SUCCEED.
124
Prep Fulfillment Order for Transfer Back Flow
This flow creates an interaction fulfillment order and
interaction fulfillment order items for a cancelled fulfillment
order. They're used to transfer the canceled items from the
reservation location back to their parent location group for
reallocation.
Prepare
Cancelled
Fulfillment
Fulfillment
Order Canceled
Order Items for
Transfer Back
125
Flow:
Prep Fulfillment Order for Transfer Back
When does it run?
126
Flow:
Prep Fulfillment Order for Transfer Back
1. Get Canceled Fulfillment Order Information
First, the flow verifies that the fulfillment order
has a fulfill from location, and exits if it doesn't.
Otherwise, the flow gets information about the
canceled fulfillment order and its fulfillment
order items.
127
Flow:
Prep Fulfillment Order for Transfer Back
2. Check for Reshipment
Next, the flow checks whether the fulfillment
order is for a reshipment.
If it's a normal fulfillment order, then the
interaction fulfillment order will transfer its
reservations back to their original location group.
If it's for a reshipment, then the interaction
fulfillment order will release its reservations.
128
Flow:
Prep Fulfillment Order for Transfer Back
3a. Create Interaction Fulfillment Items
Now it's time to create interaction fulfillment items for each of the fulfillment
order items.
129
Flow:
Prep Fulfillment Order for Transfer Back
3b. Check for Reservation Location
The first step is to initialize a temporary interaction
fulfillment order item record and get the order item
summary data.
Then the flow verifies that the order item has a reserved at
location set. If not, it creates a process exception and exits.
130
Flow:
Prep Fulfillment Order for Transfer Back
3c. Create Interaction Fulfillment Item
Next, the flow looks at the order item's reserved at location. If it's the same location that
the fulfillment order's assigned to, rather than a location group, then it's a BOPIS item.
In that case, we don't want to transfer it anywhere else, and the flow skips it.
Otherwise, it sets the from location and the to location or location group for the
interaction fulfillment item.
131
Flow:
Prep Fulfillment Order for Transfer Back
3d. Add Interaction Fulfillment Item to List
Now that the interaction fulfillment item is ready, the flow adds it to a list and continues
looping through the fulfillment order items.
132
Flow:
Prep Fulfillment Order for Transfer Back
4. Create Interaction Fulfillment Order and Items
Finally, if there are any items to transfer, the flow creates the interaction fulfillment order
and interaction fulfillment order items. It sets the interaction fulfillment order's Status__c
to REQUESTED.
It also sets the interaction fulfillment order's Type__c. The value depends on whether the
fulfillment order was a reshipment:
● Not reshipment: TRANSFER_CANCEL
● Reshipment: TRANSFER_RELEASE
Fulfillment Prepare
Order Item Cancelled
Quantity Quantity for
Decremented Transfer Back
134
Flow:
Prep Fulfillment Order Item for Transfer Back
When does it run?
135
Flow:
Prep Fulfillment Order Item for Transfer Back
1. Get Cancelled Fulfillment Item Information
First, the flow gets the rest of the
information it needs about the fulfillment
order item being cancelled, including the
original location group, current reservation
location, and product SKU.
Before continuing, the flow checks the order
item's ReservedAtLocation, which is the
reservation's original location group. If it's
null, then there's no location group to
transfer the reservation back to. In that case,
the flow creates a process exception and
exits. 136
Flow:
Prep Fulfillment Order Item for Transfer Back
2. Check for BOPIS or Reship
If the cancelled fulfillment order item was intended for
in-store pickup, we can't simply reallocate it to a different
location. In that case, the flow exits.
Otherwise, the flow checks whether the fulfillment order is
a reshipment and sets the transfer type accordingly.
13
7
Flow:
Prep Fulfillment Order Item for Transfer Back
3. Create Interaction Fulfillment Records
Finally, the flow creates an interaction fulfillment order and interaction
fulfillment order item with the following values:
● InteractionFulfillmentOrder.Schedule__c: Current datetime
● InteractionFulfillmentOrderItem.Quantity__c: (Old Quantity - New
Quantity) from the event record
● InteractionFulfillmentOrderItem.ToLocationGroup__c: original
ReservedAtLocation from the order item
● Both records: Status__c: REQUESTED
● Both records: Type__c:
○ Not reshipment: TRANSFER_CANCEL
○ Reshipment: TRANSFER_RELEASE
The Type__c value controls whether the interaction fulfillment order is
processed by the Transfer Back Reservation flow or the Release Reship
Inventory Reservation flow.
13
8
Transfer Back Reservation Flow
This flow transfers reservations from a fulfillment location
back to their original location group so they can be rerouted.
It's used when a fulfillment location cancels a fulfillment
order or fulfills a partial quantity of an order item. In the
latter case, only the unfulfilled quantity is transferred.
Transfer
Interaction
Reservations
Fulfillment
Back to
Order for Cancel
Original
Created or
Location
Updated
Group
139
Flow:
Transfer Back Reservation
When does it run?
140
Flow:
Transfer Back Reservation
1. Get Item Data and Create Transfer Inputs
First, the flow gets the interaction fulfillment
order items and loops through them.
For each item, it creates an input for the
Transfer Reservation call and adds it to a list.
141
Flow:
Transfer Back Reservation
2. Transfer Inventory Reservations
The flow then passes the transfer requests to the Transfer Reservation
invocable action.
If the action call fails, and the failure limit hasn't been reached, the
interaction fulfillment order is rescheduled to be processed again in
one hour.
If the failure limit is reached, then the flow creates a process exception
and sets the interaction fulfillment order's Status__c to ABANDONED.
This flow uses a failure limit of 4. It abandons the interaction fulfillment
order if the action call fails a fifth time.
142
Flow:
Transfer Back Reservation
3. Check for Errors
If the action returns any errors, the flow creates a
process exception and sets the interaction fulfillment
order's Status to COMPLETED_FAIL.
Otherwise, we're all set, and it sets the interaction
fulfillment order's Status to COMPLETED_SUCCEED.
143
Release Reship Inventory Reservation Flow
This flow releases reservations for reshipments that the
fulfillment location cancels.
It's used when a fulfillment location cancels a reshipment
fulfillment order or fulfills a partial quantity of a reshipment
order item. In the latter case, only the unfulfilled quantity is
released.
Interaction
Fulfillment
Release
Order for Cancel
Reservations
Reship Created
or Updated
144
Flow:
Release Reship Inventory Reservation
When does it run?
145
Flow:
Release Reship Inventory Reservation
1. Get Item Data and Create Release Inputs
First, the flow gets the interaction fulfillment
order items and loops through them.
For each item, it creates an input for the
Release Reservation call and adds it to a list.
146
Flow:
Release Reship Inventory Reservation
2. Release Inventory Reservations
The flow then passes the release requests to the Release Reservation
invocable action.
If the action call fails, and the failure limit hasn't been reached, the
interaction fulfillment order is rescheduled to be processed again in
one hour.
If the failure limit is reached, then the flow creates a process exception
and sets the interaction fulfillment order's Status__c to ABANDONED.
This flow uses a failure limit of 4. It abandons the interaction fulfillment
order if the action call fails a fifth time.
147
Flow:
Release Reship Inventory Reservation
3. Check for Errors
If the action returns any errors, the flow creates a
process exception and sets the interaction fulfillment
order's Status to COMPLETED_FAIL.
Otherwise, we're all set, and it sets the interaction
fulfillment order's Status to COMPLETED_SUCCEED.
148
Thank You