Order purge

The Order Purge agent is a task-based purge agent that archives data to the history tables.

Order purge reduces the load on frequently accessed tables. It works on a task queue. It picks up the orders from YFS_TASK_Q table that are available for the transaction PURGE.

If the purge criteria are not met, the AVAILABLE_DATE is calculated based on the modify time stamp of the order in the YFS_ORDER_HEADER and the YFS_TASK_Q tables, whichever is the maximum, and retention days are added to the new AVAILABLE_DATE.

This transaction depends on all lines of an order that is in a status pickable by the Purge transaction.

The following statuses are available for configuration to be picked up by Order Purge:

  • Draft Created (1000) and all extended Draft Created Statuses.
  • Created (1100) and all extended Created statuses. These statuses are available only for document types Sales Order, Purchase Order, and Transfer Order.
  • Released (3200) and all extended Released statuses.
  • Shipped (3700) and all extended Shipped statuses.
  • Completed (3700) and all extended Completed statuses. These statuses are available only for the document type Master Order.
  • Received (3900) and all extended Received statuses.
  • Cancelled (9000) and all extended Cancelled statuses.
  • Shorted (9020) and all extended Shorted statuses.

You can use purge codes pseudo-logic to analyze purges. If the following conditions are met, an order is picked up for purge:

  • All open child orders (derived, chained, return, exchange, procurement, or refund fulfillment) for the order must already be purged.
  • No pending transfer-out charges to another order that exceeds the transfer-ins.
  • No pending adjustment invoices.

An order is purged immediately if it meets the above three criteria and is cancelled with payment collection complete.

For the purge agent to pick up a cancelled order, the payment status of the order must be one of the following values:

  • Paid
  • Not Applicable

If an order does not meet any of the purge criteria, continue checking for the following criteria:

  • No order release status record that does not meet the retention days.
  • It is in the correct status for purge. For example,
    • All service requests for the order must be in Shipped or extended Shipped status.
    • The payment status for the order must be Paid or Not Applicable.
    • It must not have any unpurged negotiations.
  • For all order lines other than service request lines:
    • If the Seller inventory update is required, the Status Inventory Type has the “Update Seller Supply” option that is turned on, and the Seller Supply Type is “Onhand”, or blank. (The Seller Supply Type can also be a custom seller supply type with the “Onhand Supply” check box enabled.)
    • If the Seller Demand Type is blank.
    • If the Buyer inventory update is required and the Buyer Supply Type is “Onhand”, or blank.
  • The last modification of the order must fall before the lead time (in days) set up.
  • Any enterprise that uses the Console must schedule purge transactions.
  • The order must not have an undelivered service line.
  • In an exchange order for processing a return order, the exchange order must be purged from history before the return order is purged.

With no change to status inventory type, a Shipped (3700) status or its extended status is purged if the Buyer is not passed.

An order in Shipped status or extended Shipped status in the default pipeline is not purged if the Buyer passed on the tracking inventory. Therefore, the purging of the order that is related to the pending supply for the Buyer tracking inventory is prevented.

To purge such orders, the status inventory type for the Shipped or extended Shipped status must be configured such that the Buyer Supply Type is ONHAND for the status inventory type.

If the Inventory Published flag for the organization is set to Y, the Buyer Supply Type should be ONHAND in order to purge the shipped order. If the Inventory Published flag for the organization is set to N, the shipped order will be purged regardless of the Buyer Supply Type specified.

When the purge agent is run, the draft order without lines is purged to the order history table. When the purge history agent is run, the draft orders without lines get deleted permanently.

The Order Purge agent is capable to delete the order audit records instead of writing them to history tables, on purge of an order. If you do not have a continuous use of order audits after orders are purged to history, you can consider this feature, and it helps to make order history data lighter. You need to set the yfs.purge.order.orderaudit.delete property to true to enable this feature. By default, the property is set to false and order audit data is purged and moved to order audit history tables..

The Sterling Order Management System also provides a user exit named YFSBeforeOrderAuditPurgeUE in relation with this feature. The user exit can publish the order audit records being deleted from Sterling Order Management System on purge of an order. You can implement the user exit if you want to store order audit records externally to Sterling Order Management System to refer in the future.

Attributes

The following are the attributes for this time-triggered transaction:

Table 1. Order purge attributes
Attribute Value
Base Transaction ID PURGE
Base Document Type Order
Base Process Type Order Fulfillment
Abstract Transaction No
APIs Called None
User Exits Called YFSBeforePurgeUE

Criteria parameters

The following are the criteria parameters for this transaction:

Table 2. Order purge criteria parameters
Parameter Description
Action Required. Triggers the transaction. If left blank, it defaults to Get, the only valid value.
Number of Records To Buffer Optional. Number of records to retrieve and process. If left blank or specified as 0 (zero), it defaults to 5000.
Next Task Queue Interval Optional. Specifies in hours how long a failed task must be suspended before it is considered for reprocessing. Defaults to 5 hours.
Task Queue Filter Criteria Optional. Determines the jobs to be retrieved by the agent. The value that is assigned to this parameter is matched against the value that is stored in the FILTER_CRITERIA column of the YFS_TASK_Q table, while retrieving the jobs. The possible values for the parameter depend on the following two default segregation policies that are implemented for the order entity.
  • Order Line Size - Valid values for the order line size based segregation policy are VeryLarge, Large, and VOID.
  • Order Attribute - Valid values for the order-attribute based segregation policy are the distinct values that can be assigned to the order attribute that is configured for segregation and VOID.
Note: VOID is a valid task queue filter criteria value irrespective of the segregation policy. It is used to match records with NULL value in the FILTER_CRITERIA column of YFS_TASK_Q table.

The parameter accepts multiple values so that the jobs that match the values can be retrieved or processed together. Use comma-separated enumerations when you assign multiple values to the parameter.

For more information, see Workload segregation for task queue agents.

EnterpriseCode Optional. Enterprise for which the Order Purge needs to be run. If not passed, then all enterprises are monitored.

When the EnterpriseCode is blank, the purge criteria that are configured for the DEFAULT enterprise is used.

Note:
  • If you define the EnterpriseCode criteria parameter, but do not define the retention days for an enterprise, the Order Purge agent considers the default 30 days retention period for purging orders to history tables.

    If an organization inherits configuration from another enterprise, the retention days that you configured at the parent organization level is considered for purging orders to history tables.

  • If you do not define the EnterpriseCode criteria parameter, the Order Purge agent purges orders to the history table based on retention days that is defined at the DEFAULT level for all enterprises.
Live Optional. Mode in which to run. Valid values are:
  • Y - Default value. Moves qualifying records from the regular tables that are listed under Tables Purged to the corresponding history tables.
  • N - Test mode. Determines the rows that are moved to history tables without actually moving them.
PurgeCode Required. Used for internal calculations, such as determining retention days. Corresponds with the PurgeCode used in Business Rules Purge Criteria. You can set this parameter to the following values:
  • DRAFTORDERHISTPRG to purge draft order information from the order history tables.
  • DRAFTORDERNOLINEHISTPRG to purge draft orders without order lines from the order history tables.
  • DRAFTORDERNOLINEPRG to purge draft orders that have no order lines.
  • DRAFTORDERPRG to purge draft order information and archive it in the order history tables.

PurgeCode cannot be set to the value ORDER_RELEASE_STATUS_PURGE.

AdditionalPurgeCode Optional. To purge order release status records, set this parameter to ORDER_RELEASE_STATUS_PURGE.

For more information, see Order release status purge.

ColonyID Required in a multi-schema deployment where a table might exist in multiple schemas. Runs the agent for the colony.
AttributeName Optional. OrderType.
AttributeValue

If order purging is required based on "OrderType(AttributeName)", AttributeValue is required otherwise it is optional.

Multiple OrderTypes in the comma-separated format are defined by a user in the product.

RetentionDays

If order purging is required based on "OrderType(AttributeName)", RetentionDays is required otherwise it is optional.

RetentionDays data is in the comma-separated format, and the index must match with the respective AttributeValue that is OrderType value.

Statistics tracked

The following statistics are tracked for this transaction:

Table 3. Order purge statistics
Statistic Name Description
NumOrdersProcessed Number of orders processed.
NumOrdersPurged Number of orders purged.

Pending job count

The pending job count is the number of records available to be processed by the transaction with the AVAILABLE_DATE value less than or equal to (<=) the current date value in the YFS_Task_Q table.

Events raised

The ON_INCOMPLETE_PAYMENT event is raised if an order is not purged for payment-related reasons such as:
  • Payment status of the order is not yet PAID
  • Non-Zero charge credit amount for Draft Order

Tables purged

YFS_ACTIVITY_DEMAND

YFS_ANSWER_SET_TRAN

YFS_ANSWER_TRAN

YFS_CHARGE_TRANSACTION

YFS_CHARGE_TRAN_DIST

YFS_CHARGE_TRAN_REQUEST

YFS_CHARGE_TRAN_RQ_MAP

YFS_CREDIT_CARD_TRANSACTION

YFS_ENTITY_ADDRESS

YFS_HEADER_CHARGES

YFS_INSTRUCTION_DETAIL

YFS_INVOICE_COLLECTION

YFS_LINE_CHARGES

YFS_MONITOR_ALERT

YFS_NOTES

YFS_ORDER_AUDIT

YFS_ORDER_AUDIT_DETAIL

YFS_ORDER_AUDIT_LEVEL

YFS_ORDER_HEADER

YFS_ORDER_HEADER_EXTENSION

YFS_ORDER_HOLD_TYPE

YFS_ORDER_HOLD_TYPE_LOG

YFS_ORDER_INVOICE

YFS_ORDER_INVOICE_DETAIL

YFS_ORDER_KIT_LINE

YFS_ORDER_KIT_LINE_SCHEDULE

YFS_ORDER_LINE

YFS_ORDER_LINE_EXTENSION

YFS_ORDER_LINE_OPTION

YFS_ORDER_LINE_OPTION_EXTENSION

YFS_ORDER_LINE_REQ_TAG

YFS_ORDER_LINE_RESERVATION

YFS_ORDER_LINE_SCHEDULE

YFS_ORDER_LINE_SRC_CNTRL

YFS_ORDER_PROD_SER_ASSOC

YFS_ORDER_RELEASE

YFS_ORDER_RELEASE_STATUS

YFS_ORDER_SER_PROD_ITEM

YFS_ORDER_DATE

YFS_PAYMENT

YFS_PMNT_TRANS_ERROR

YFS_PROMOTION

YFS_PROMOTION_AWARD

YFS_RECEIVING_DISCREPANCY

YFS_RECEIVING_DISCREPANCY_DTL

YFS_REFERENCE_TABLE

YFS_TAX_BREAKUP

YIC_BOM_HEADER

YIC_BOM_LINE

YIC_BOM_MESSAGE

YIC_BOM_PROP

YFS_ADDNL_LINE_PRICE