Duplicate order alert
When placing an order by using the application, a customer might inadvertently click the Submit button twice, thereby creating duplicate orders. To avoid this scenario, every order that is captured must be checked against orders with similar attributes.
Solution
The following section describes APIs, user exits, services, and other components.
When a draft order is
confirmed, or an order is created, the YCD_DUPLICATE_ORDER
hold
is applied to the order. The hold prevents any transaction from processing
the order, and is processed by the Duplicate Order agent, which is
derived from the Process Order Hold Type base transaction.
Details for the duplicate order agent are described in the following table:
Attribute | Value |
---|---|
Base Transaction ID | PROCESS_ORDER_HOLD_TYPE |
Base Document Type | 0001 (Sales Order) |
Base Process Type | ORDER_FULFILLMENT (Order Fulfillment) |
Abstract Transaction | Yes |
APIs Called | checkDuplicateOrder |
Parameter | Description |
---|---|
Action | This field is used
internally by the application.
The only valid value is Get . Do not modify this field. |
Number of Records to Buffer | Optional. Number of records to retrieve and
process at one time. If left blank or specified as 0 (zero),
it defaults to 5000 . |
CollectPendingJobs | If
this parameter is set to N ,
the agent does not collect information on the pending jobs for this
time-triggered transaction. This pending job information is used to
monitor the agent in the System Management Console.By default, |
Next Task Queue Interval | The number of hours to wait before attempting to check for duplicate orders again. If not set, the default value is 5 hours from the current time. |
Transaction/Event | Key Data | Data Published | Template Support? |
---|---|---|---|
ON_DUPLICATE_ORDER |
OrderHeaderKey, OrderNo |
|
Yes |
|
modifyOrder_dbd.txt |
|
Yes |
ON_SUCCESS |
modifyOrder_dbd.txt |
|
Yes |
YFSProcessOrderHoldTypeUE
user
exit, which is implemented as the YCD_ProcessCustOrdMgmtHolds_1.0
service
as illustrated in the following figure.
In this case, the processDuplicateOrderHold
custom
API is called, which in turn calls the checkDuplicateOrder
API,
which finally calls the YCDProcessDuplicateOrderCheckUE
user
exit.
The user exit takes the following file as its input XML:
<INSTALL_DIR>/repository/xapi/template/merged/userexit/processDuplicateOrderCheck.0001.xml
YCD_ProcessDuplicateOrderCheck_1.0
service
as illustrated in the following figure.
In this service, the getOrderList
API
is called by using the output of the getDuplicateOrderCriteria
custom
API as input. If more than one record is returned by the getOrderList
API
call, then the order is a potential duplicate.
- Bill To ID: if the identifier of the customer on the orders is identical.
- Total Amount: if the total amount on the orders are within $5 of each other.
- Order Date: if the timestamp on the orders is within 20 seconds of each other.
- Enterprise Code: if the enterprise code on the orders is identical.
- IP address: if the IP address of the customer on the orders is identical.
When a duplicate order is identified, the ON_DUPLICATE_ORDER
event
is raised by the Duplicate Order agent, which invokes the YCD_DuplicateOrderAlert_1.0
service
through the YCDOnDuplicateOrder
action. The YCD_DuplicateOrderAlert_1.0
service
sends an alert to the Duplicate Order queue.
Implementation
- Ensure that the
YCD_DUPLICATE_ORDER
hold type is implemented for the enterprise that does the duplicate order checks. Do the following steps to implement a Duplicate Order hold type:- Launch Applications Manager -> Distributed Order Management, and load the enterprise that checks for duplicate orders.
- Go to Distributed Order Management -> <Document Specific> -> <Document Type> -> Fulfillment -> Hold Types.
- Click
the Create icon to create the duplicate
order hold type with the following details:
- In the Hold
Type field, enter
YCD_DUPLICATE_ORDER
. - In the Hold Creation tab, select the following
options:
- On Draft Order Confirmation
- On Order Creation
- In the Hold Resolution tab, select Duplicate Order as the time triggered transaction that will process the created holds.
- In the Hold Effects tab, you can specify the transactions that will be stopped from processing orders on this hold. Additionally, you can specify the modifications that are not allowed for orders on this hold.
- In the Hold
Type field, enter
- Click Save. The hold type is saved.
Note: The attributes mentioned in the procedure are important. Additionally, you can specify other attributes for the hold type based on your business needs. - In the
YCD_DuplicateOrderAlert_1.0
service, the alert sent to the Duplicate Order queue uses the following XSL by default:<INSTALL_DIR>/repository/xapi/template/merged/exception_console/YCD_DuplicateOrderAlert.xsl.sample
. Copy the XSL to a file namedYCD_DuplicateOrderAlert.xsl
, customize as needed, and copy its path and name in the Template Name field of the Alert properties.
You can save it to another directory, but using the standard directory structure that is supplied by the Sterling™ Order Management System Software helps ensure consistency.
You can customize all services and user
exits to adapt to changing business needs. You can also customize
the getDuplicateOrderCriteria
custom API to return
the exact set of criteria that you use to determine whether an order
is duplicate.
End-user impact
The user can ensure that duplicate orders do not exist in the system.