Legacy platform

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:

Table 1. Attributes
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
Table 2. Criteria parameters
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, CollectPendingJobs is set to Y. It can be helpful to set it to N if one particular time-triggered transaction is performing a significant number of getPendingJobs queries, and the overhead cost is too high.

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.
Table 3. Events raised by the duplicate order agent
Transaction/Event Key Data Data Published Template Support?
ON_DUPLICATE_ORDER OrderHeaderKey, OrderNo
VERIFY_ADDRESS.0001.
VERIFY_ADDRESS_
FAILED.0001.xml
Yes
ON_HOLD_TYPE_STATUS
_CHANGE
modifyOrder_dbd.txt
PROCESS_ORDER_HOLD_
TYPE.
ON_HOLD_TYPE_STATUS_
CHANGE.xml
Yes
ON_SUCCESS modifyOrder_dbd.txt
PROCESS_ORDER_HOLD_
TYPE.
ON_SUCCESS.xml
Yes
The Duplicate Order agent calls the YFSProcessOrderHoldTypeUE user exit, which is implemented as the YCD_ProcessCustOrdMgmtHolds_1.0 service as illustrated in the following figure.
Figure 1. YCD_processCustOrdMgmtHolds_1.0 service
Service to process duplicate order holds

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

The XML is then passed on to the YCD_ProcessDuplicateOrderCheck_1.0 service as illustrated in the following figure.
Figure 2. The yCD_processDuplicateOrderCheck_1.0 service
Service to do duplicate order check

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.

By default, the criteria to determine a duplicate order are as follows:
  • 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

To use this feature, you must do the following steps:
  1. 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:
    1. Launch Applications Manager -> Distributed Order Management, and load the enterprise that checks for duplicate orders.
    2. Go to Distributed Order Management -> <Document Specific> -> <Document Type> -> Fulfillment -> Hold Types.
    3. 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.
    4. 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.
  2. 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 named YCD_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.