Order audit delete purge

The Order Audit Delete Purge agent extends the Order Purge agent's capabilities by deleting the order audit records from Sterling Order Management System Software before the Order Purge agent purges the order.

You can enable this feature using an additional purge code in the criteria for Order Purge agent. If the additional purge code is configured, the order audit records are deleted from the YFS_ORDER_AUDIT, YFS_ORDER_AUDIT_LEVEL, and YFS_ORDER_AUDIT_DETAIL tables when the corresponding order meets the functional criteria to purge. The data of the order is deleted completely from these tables, instead of writing to the corresponding history tables.

When the Order Audit Delete Purge agent completes deleting audits for an order, the AVAILABLE_DATE of the task queue job is recalculated according to the retention days specified for the order purge code or any other additional purge code, configured in the Order Purge agent criteria. This enables the Order Purge agent to pick up the order later to process the remaining purge actions as necessary.

Enabling Order Audit Delete Purge agent

To enable early deletion of order audits before the actual purge of orders, edit your agent criteria for the Order Purge agent and specify the AdditionalPurgeCode criteria parameter value as ORDERAUDITDEL. The AdditionalPurgeCode parameter accepts comma-separated values. The another additional purge code supported by Sterling Order Management System Software is ORDER_RELEASE_STATUS_PURGE. This helps deletion of zero-quantity release status records of an order. If you want to delete both order audit and zero-quantity release status records before the order purge, you can set values of AdditionalPurgeCode to ORDERAUDITDEL, ORDER_RELEASE_STATUS_PURGE.

If the following conditions are met, the Order Purge agent deletes the order audit records:

  • All the conditions for Order Purge are met except for the child orders purge check condition. For more information about the conditions for Order Purge, see Order purge.
  • The AdditionalPurgeCode parameter value in the Order Purge criteria is set to ORDERAUDITDEL.
  • The last modification date of order must be a day before the retention days that was set up for ORDERAUDITDEL purge code.
The Order Purge agent always delete order audit records and does not write the audit records to history when all of the following conditions are met:
  • Entire order is available to purge at the time of processing the order by Order Purge agent
  • Agent criteria is configured with ORDERAUDITDEL additional purge code
  • Retention days given for the Order Audit Delete Purge (ORDERAUDITDEL) code is less than the retention days given for Order Purge (ORDERPRG) code

AdditionalPurgeCode scenarios

When the Order Audit Delete Purge agent completes job for an order, the AVAILABLE_DATE of task queue is recalculated as explained in the following scenarios. This enables the Order Purge agent to pick up the order later to process the remaining purge actions as necessary.

  • Scenario 1:
    • AdditionalPurgeCode value is set to ORDERAUDITDEL
    • Retention days set for ORDERAUDITDEL are less than the ORDERPRG lead days

    In scenario 1, Order Purge agent runs in Order Audit Delete Purge mode and once the order audit records are deleted, the AVAILABLE_DATE of task queue is set to the date considering retention days configured for Order Purge (ORDERPRG) code.

  • Scenario 2:
    • AdditionalPurgeCode values are set to ORDERAUDITDEL and ORDER_RELEASE_STATUS_PURGE
    • Retention days set for ORDER_RELEASE_STATUS_PURGE are greater than the ORDERAUDITDEL lead days and less than the ORDERPRG lead days

    In scenario 2, Order Purge agent runs in Order Audit Delete Purge mode and once the order audit records are deleted, the AVAILABLE_DATE of task queue is set to the date considering retention days for Order Release Status Purge (ORDER_RELEASE_STATUS_PURGE) code.

  • Scenario 3:
    • AdditionalPurgeCode values are set to ORDERAUDITDEL and ORDER_RELEASE_STATUS_PURGE
    • Retention days set for ORDERAUDITDEL are greater than the ORDER_RELEASE_STATUS_PURGE lead days and less than the ORDERPRG lead days

    In scenario 3, Order Purge agent runs in Order Release Status Purge mode and once the order release status records with zero quantity are deleted, the AVAILABLE_DATE of task queue is set to the date considering retention days for Order Audit Delete Purge (ORDERAUDITDEL) code.

  • Scenario 4:
    • AdditionalPurgeCode values are set to ORDERAUDITDEL and ORDER_RELEASE_STATUS_PURGE
    • Retention days set for ORDERAUDITDEL are equal to ORDER_RELEASE_STATUS_PURGE lead days and less than the ORDERPRG lead days

    In scenario 4, Order Purge agent runs in both Order Audit Delete Purge and Order Release Status Purge modes. Once the zero-quantity order release status records and the order audit records are deleted, the AVAILABLE_DATE of task queue is set to the date considering retention days configured for Order Purge (ORDERPRG) code.

  • Scenario 5:
    • AdditionalPurgeCode values are set to ORDERAUDITDEL and ORDER_RELEASE_STATUS_PURGE.
    • Retention days for ORDERAUDITDEL and ORDER_RELEASE_STATUS_PURGE are same as scenario 2 or scenario 3 and less than the ORDERPRG lead days
    • Order Purge agent has stopped for a while and when restarted, assume there are orders with the retention days completed for both the purge codes.

    In scenario 5, Order Purge agent runs in both Order Audit Delete Purge and Order Release Status Purge modes. Once the zero-quantity order release status records and the order audit records are deleted, the AVAILABLE_DATE of task queue is set to the date considering retention days configured for Order Purge (ORDERPRG) code.

Important: The retention days configured for Order Audit Delete Purge and Order Release Status Purge must be less than the retention days configured for Order Purge.

Attributes

The following attributes are for the Order Audit Delete Purge time-triggered transaction:
Table 1. Order Audit Delete 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 YFSBeforeOrderAuditPurgeUE

Criteria parameters

The following criteria parameters are for the Order Audit Delete Purge:

Table 2. Order audit delete 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 at one time. 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 should 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 configured for the DEFAULT enterprise is used; not the purge criteria configured for the order's enterprise.

Live Optional. Mode in which to run. Valid values are:
  • Y - Default value. Moves qualifying records from the regular tables listed under Tables data deleted to the corresponding history tables.
  • N - Test mode. Determines the rows that are moved to history tables without actually moving them.
PurgeCode Required. To extend the Order Purge agent to purge order audit records, set to ORDERPRG. Used for internal calculations, such as determining retention days. You must also set AdditionalPurgeCode.
AdditionalPurgeCode Required. To purge order audit records, set this parameter to ORDERAUDITDEL.
Note: Valid values for AdditionalPurgeCode are ORDER_RELEASE_STATUS_PURGE and ORDERAUDITDEL. It accepts comma-separated values. For example:

ORDER_RELEASE_STATUS_PURGE,ORDERAUDITDEL

ColonyID Required in a sharded deployment where a table may exist in multiple schemas. Runs the agent for the colony.

Statistics tracked

The following statistics are tracked for this transaction:

Table 3. Order audit delete purge statistics
Parameter Description
NumOrderAuditsDeletePurged Number of order audits deleted.

Pending job count

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

Events raised

None.

Tables data deleted

  • YFS_ORDER_AUDIT
  • YFS_ORDER_AUDIT_LEVEL
  • YFS_ORDER_AUDIT_DETAIL