OMS Web App: Search order by ID using the Rules SDK
Author:
Randy Chan
Changed on:
10 June 2025
Key Points
- This is the use case where users can look up OMS orders using order ID.
- Typically, the
`orderById`
GraphQL query is used to look up an order by ID. However, only one order can be searched at a time, and there is no wildcard search. - This article provides an alternative approach that allows users to search for orders by ID or even with a wildcard, leveraging the new
`ref2`
field on the order entity included in the Enhanced Order Lookup and Tagging Capabilities release.

Steps
Steps to achieve the outcome
- Create a custom rule
`CopyOrderIdToOrderRef2`
(by using the Rules SDK) - Add the rule
`CopyOrderIdToOrderRef2`
to the order workflows - Extend the Order list screen manifest to include fc.filterPanel with ref2
- Test the outcome
Create a custom rule, CopyOrderIdToOrderRef2
- Open the Rules SDK and create a new Java rule:
`CopyOrderIdToOrderRef2`
- Compile to a jar and install the plugin onto your account.
- Use GET: {{fluentApiHost}}/orchestration/rest/v1/plugin to check the new available rule.

1package RANDY6.rule;
2
3import com.fluentretail.rubix.foundation.graphql.RANDY6.mutations.UpdateOrderMutation;
4import com.fluentretail.rubix.foundation.graphql.type.UpdateOrderInput;
5import com.fluentretail.rubix.rule.meta.EventInfo;
6import com.fluentretail.rubix.rule.meta.RuleInfo;
7import com.fluentretail.rubix.v2.context.Context;
8import com.fluentretail.rubix.v2.rule.Rule;
9
10import java.util.Collections;
11
12
13@RuleInfo(
14 name = "CopyOrderIdToOrderRef2",
15 description = "Copy Order.id To Order.Ref2",
16 accepts = {
17 @EventInfo(entityType = "ORDER")
18 }
19)
20
21public class CopyOrderIdToOrderRef2 implements Rule {
22 @Override
23 public void run(Context context) {
24
25 UpdateOrderInput updateOrderInput = UpdateOrderInput.builder()
26 .id(context.getEntity().getId())
27 .ref2(context.getEntity().getId().toString())
28 .build();
29
30 UpdateOrderMutation mutation = UpdateOrderMutation.builder()
31 .input(updateOrderInput)
32 .build();
33
34 context.action().mutation(mutation);
35 }
36}
37
Add the rule CopyOrderIdToOrderRef2 to the order workflows
Once CopyOrderIdToOrderRef2 is deployed, you can add a new into the CREATE in the workflows (HD and CC):


1{
2 "name": "{{AccountID}}.{{packageName}}.CopyOrderIdToOrderRef2",
3 "props": null
4},
Save the change.
Extend the Order list screen manifest to include fc.filterPanel with ref2
This will be done in the settings: `fc.mystique.manifest.oms.fragment.ordermanagement`
First, add `fc.filterPanel`
above the `fc.list`
:
1"descendants": [
2{
3 "component": "fc.filterPanel",
4 "props": {
5 "filtersSource": "orders",
6 "allowReadWriteUrlParams": true,
7 "additionalFields": [],
8 "overrides": {
9 "ref": {
10 "component": "fc.field.multistring",
11 "label": "Order ref",
12 "exactSearch": false,
13 "visibleItemsThreshold": 3
14 },
15 "ref2": {
16 "component": "fc.field.multistring",
17 "label": "Order ref2",
18 "exactSearch": false,
19 "visibleItemsThreshold": 3
20 }
21 },
22 "exclude": [
23 "productRef",
24 "createdon",
25 "updatedOn",
26 "quantity",
27 "paidPrice",
28 "currency",
29 "retailerId",
30 "price",
31 "taxPrice",
32 "taxType",
33 "totalPrice",
34 "totalTaxPrice",
35 "type",
36 "status",
37 "tag1",
38 "tag2",
39 "tag3"
40 ]
41 }
42},
43{
44 "component": "fc.list",
45 "props": {
46 "defaultPageSize": 100,
47 "dataSource": "orders",
48...
Then, for testing purposes, add the following id and ref2 to the `fc.list`
attributes section:
1{
2 "label": "order id",
3 "template": "{{node.id}}"
4},
5{
6 "label": "ref2",
7 "template": "{{node.ref2}}"
8},
Save the change
Test the outcome
Create a few new orders, and the new will populate ref2. Then go to the List page and refresh the browser to get the latest :
Search order by ID using the ref2 field
Search by ID using the ref2 field
Except as otherwise stated in the Extend Knowledge Content site policy, the content on this page is licensed under the Creative Commons Attribution 4.0 Licence, and any code samples that appear on this page are licensed under the Apache 2.0 Licence, unless any code sample forms part of the Fluent Order Management Platform code. Neither of these licences apply to any content on any other page that can be reached via a link on this page unless otherwise specified on that other page. If you wish to use any of the Extend Knowledge Content, you must do so in compliance with the licenses referred to above and the Extend Knowledge Content site policy, including attribution in the manner set out on this page.