Order purge

This purge archives data into history tables after it completes its typical lifecycle. To purge orders from history tables, seeOrder history purge. 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 purge criteria are not met, AVAILABLE_DATE is calculated based on the modify time stamp of the order in YFS_ORDER_HEADER table and the YFS_TASK_Q table, whichever is maximum. To this value, 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:

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

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:

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

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.

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.
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.

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, seeOrder release status purge.

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

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