Sales Order and Purchase Order Audit Trail

Fashion & Management  •  Article  •  9/23/2026  • 

The Audit Trail functionality captures comprehensive change tracking for Sales Order and Purchase Order documents. The system automatically captures and stores all changes made to configured fields, including insert, modify, and delete operations. The system derives business context (Customer/Vendor, Division, Season) from the document being changed. The tracked fields are configured in the Document Change Log Setup page, and the audit entries are created automatically when changes occur on documents that match the setup criteria.

Document Change Log Setup

You can use the Document Change Log Setup page to configure audit tracking for documents based on the tables you select. By adding tables and enabling tracking, you standardize how field changes are captured across Sales and Purchase documents. The system creates audit entries automatically when you modify configured fields on matching documents.

  • If a table is added to the Document Change Log Setup page, its Enable checkbox is selected, and fields are configured for that table, the system captures changes to those fields.

  • If no fields are configured for tracking in a table, no audit entries are created for that table even if the Enable checkbox is selected.

The system only tracks fields that are explicitly configured in the Field Configuration. Disabling a table (by clearing the Enable checkbox) stops creating new entries while preserving existing audit history.

To add a table for document change tracking, follow these steps:

  • Select the Search iconSearch icon, enter Document Change Log Setup, and then choose the related link. The Document Change Log Setup page opens.

  • On the action bar, select New action.

  • Enter the required information in the following fields:

FieldDescription
Table IDSpecifies the ID of the table to track (e.g., 38 for Purchase Header, 39 for Purchase Line, 36 for Sales Header, 37 for Sales Line).
Table NameSystem-populated field displaying the name of the selected table (e.g., Purchase Header, Purchase Line). This field is read-only.
EnabledSpecifies whether audit tracking is active for this table. When enabled, changes to configured fields in this table are automatically logged. Only changes made after enabling are recorded.
No. of Fields AvailableDisplays the total number of fields available in the table that can be configured for tracking. This field is read-only.
No. of Fields to Log InsertionDisplays the count of fields configured to track Insert operations. This field is read-only.
No. of Fields to Log ModificationDisplays the count of fields configured to track Modify operations. This field is read-only.
No. of Fields to Log DeletionDisplays the count of fields configured to track Delete operations. This field is read-only.
Filters CountDisplays the number of active filters configured for this table. This field is read-only.
Last Modified AtDisplays the date and time when the setup line was last modified. This field is read-only.
Last Modified ByDisplays the user ID who last modified the setup line. This field is read-only.

Configure fields to track

You can define which fields generate audit entries for each operation type. To configure fields for tracking, follow these steps:

  • On the Document Change Log Setup page, select the table line you want to configure.

  • On the action bar, select Fields action.

The Document Change Log Setup Fields page opens.

  • Enable or disable tracking for each field by selecting the appropriate checkboxes:
ActionDescription
Edit ListEnables inline editing of the field configuration lines.
Enable All - Log InsertionEnables the Log Insertion checkbox for all fields in the list.
Disable All - Log InsertionDisables the Log Insertion checkbox for all fields in the list.
Enable All - Log ModificationEnables the Log Modification checkbox for all fields in the list.
Disable All - Log ModificationDisables the Log Modification checkbox for all fields in the list.
Enable All - Log DeletionEnables the Log Deletion checkbox for all fields in the list.
Disable All - Log DeletionDisables the Log Deletion checkbox for all fields in the list.

Field Configuration - Field Descriptions

FieldDescription
Field IDSpecifies the field number within the selected table. This is the unique identifier for the field in the table schema.
Field NameDisplays the internal field name for reference purposes. This field is read-only.
Field CaptionDisplays the user-friendly caption of the field as shown in the Business Central user interface. This field is read-only.
Field TypeDisplays the data type of the field (e.g., Option, Code20, Text100, Text50, Text30, Code10). This field is read-only.
Log InsertionBoolean field. When enabled, the system logs changes to this field when a new record is inserted.
Log ModificationBoolean field. When enabled, the system logs changes to this field when an existing record is modified.
Log DeletionBoolean field. When enabled, the system logs the field value when a record is deleted.

Only fields with the Log Insertion, Log Modification, or Log Deletion checkboxes are selected to generate audit entries for the corresponding operation type. You can enable or disable tracking specific operation types at any time without affecting historical audit data.

Configure filters for a table

On the Document Change Log Setup Filters page, the following fields are populated when you add document-specific tracking criteria:

FieldDescription
Field IDSpecifies the unique field ID from the table to use as a filter criterion. Use the lookup to select from available fields in the configured table.
Field NameSystem-populated field displaying the internal name of the selected field. This field is read-only.
Field CaptionSystem-populated field displaying the user-friendly caption of the selected field (e.g., "Division Code"). This field is read-only.
Filter ValueSpecifies the filter value(s) to match. Supports values, wildcards, ranges, and pipelines consistent with Business Central filter logic (e.g., S001

Only documents matching all configured filters will have their changes tracked. If no filter value is specified, all values for that field are included in tracking.

On the Fashion & Apparel Setup page, the following field is available for retention policy configuration:

FieldDescription
Audit Trail Retention PeriodSpecifies the retention period for audit trail entries. Available options include: 1 Week, 1 Month, 6 Months, 1 Year, or custom periods. Records older than this period are automatically deleted when the retention policy is applied.

Audit Trail Retention Period

Sales Document Change Log Entries

The Sales Document Change Log Entries page displays all audit entries for Sales documents. You can search, filter, and analyze changes made to Sales Header and Sales Line tables.

  • When you select a filter in the Document No. field, the system displays only audit entries for that specific document.

  • When you select the Show All Changes for Document action, the system filters all header and line changes for the selected document only.

  • When you select the Change Summary action, the system displays aggregated information based on the current filter context.

  • When you select the Clear All Filters action, the system clears all the selected filters.

  • Open Document action is to open the selected document and incase if the document is deleted then the system displays a message indicating that the document cannot be found.

Audit entries are displayed in field ID order when multiple fields are changed in a single operation, ensuring consistent and deterministic display.

  • On the Sales Document Change Log Entries page, the following filter fields are available:
FieldDescription
Document TypeSpecifies the document type filter. Enter one or more document types to limit results (e.g., Order, Invoice).
Document No.Specifies the sales document number filter. Enter a single document number or multiple numbers using Business Central standard notation.
Customer No.Specifies the customer number filter. Enter one or more customer numbers to limit results to changes in specific customer documents.
Change TypeSpecifies the change type filter (Insertion, Modification, Deletion and Blank).
Field NameSpecifies the field name filter. Enter the field name to find changes to specific fields.
DivisionSpecifies the division code filter. Filters entries to documents assigned to the selected division.
SeasonSpecifies the season code filter. Filters entries to documents assigned to the selected season.
User IDSpecifies the user filter. Filters entries to changes made by the selected user.
Date and TimeSpecifies the starting and ending date for the range filter.

Multiple values can be entered in filter fields using Business Central standard notation. For example: C001,C002,C003 for multiple specific values or C001..C029 for a range of values.

  • On the Lines FastTab, the following fields display the audit entry details:
FieldDescription
Entry No.Specifies the unique identifier for the audit entry. This is the primary key for the audit record.
Date and TimeSpecifies the timestamp when the change occurred. The system defaults this to the system's date and time when a record is created.
Table NameSpecifies the name of the table that was changed (Sales Header or Sales Line).
Document TypeSpecifies the type of sales document (Order, Invoice, Quote, etc.).
Document No.Specifies the sales document number that was changed.
Line No.Specifies the line number for line-level changes. This value is 0 for header-level changes.
User IDSpecifies the user who made the change.
Customer No.Specifies the customer number from the document for business context.
Customer NameSpecifies the customer's name from the document for reference.
Division CodeSpecifies the division code from the document.
Season CodeSpecifies the season code from the document.
Change TypeSpecifies the type of change (Insertion, Modification, Deletion and Blank).
Field NameSpecifies the name of the field that was changed.
Old ValueSpecifies the previous value before the change. For Insert operations, this field is empty.
New ValueSpecifies the new value after the change. For Delete operations, this field is empty.

The standard Business Central Open in Excel action remains available. However, the Edit in Excel action is disabled for this page to prevent unintended data modifications.

Purchase Document Change Log Entries

The Purchase Document Change Log Entries page displays all audit entries for Purchase documents. You can search, filter, and analyze changes made to Purchase Header and Purchase Line tables.

  • When you select a filter in the Document No. field, the system displays only audit entries for that specific document.

  • When you select the Show All Changes for Document action, the system filters to all header and line changes for the selected document only.

  • When you select the Change Summary action, the system displays aggregated information based on the current filter context.

  • When you select the Clear All Filters action, the system clears all the selected filters.

  • When you select the Open Document action and the document no longer exists, the system displays a message indicating that the document cannot be found.

Audit entries are displayed in field ID order when multiple fields are changed in a single operation, ensuring consistent and deterministic display.

  • On the Purchase Document Change Log Entries page, the following filter fields are available:
FieldDescription
Document TypeSpecifies the document type filter. Enter one or more document types to limit results (e.g., Order, Invoice).
Document No.Specifies the purchase document number filter. Enter a single document number or multiple numbers using Business Central standard notation.
Vendor No.Specifies the vendor number filter. Enter one or more vendor numbers to limit results to changes on specific vendor documents.
Change TypeSpecifies the change type filter (Insertion, Modification, Deletion).
Field NameSpecifies the field name filter. Enter the field name to find changes to specific fields.
Division CodeSpecifies the division code filter. Filters entries to documents assigned to the selected division.
Season CodeSpecifies the season code filter. Filters entries to documents assigned to the selected season.
User IDSpecifies the user filter. Filters entries to changes made by the selected user.
From DateSpecifies the starting date for the date range filter.
To DateSpecifies the ending date for the date range filter.

Multiple values can be entered in filter fields using Business Central standard notation. For example: V001,V002,V003 for multiple specific values or V001..V029 for a range of values.

  • On the Lines FastTab, the following fields display the audit entry details:
FieldDescription
Entry No.Specifies the unique identifier for the audit entry. This is the primary key for the audit record.
Date TimeSpecifies the timestamp when the change occurred. The system defaults this to the system date and time when a record is created.
Table NameSpecifies the name of the table that was changed (Purchase Header or Purchase Line).
Document TypeSpecifies the type of purchase document (Order, Invoice, Quote, etc.).
Document No.Specifies the purchase document number that was changed.
Line No.Specifies the line number for line-level changes. This value is 0 for header-level changes.
User IDSpecifies the user who made the change.
Vendor No.Specifies the vendor number from the document for business context.
Vendor NameSpecifies the vendor’s name from the document for reference.
Division CodeSpecifies the division code from the document.
Season CodeSpecifies the season code from the document.
Change TypeSpecifies the type of change (Insert, Modify, Delete).
Field NameSpecifies the name of the field that was changed.
Old ValueSpecifies the previous value before the change. For Insert operations, this field is empty.
New ValueSpecifies the new value after the change. For Delete operations, this field is empty.

The standard Business Central Open in Excel action remains available. However, the Edit in Excel action is disabled for this page to prevent unintended data modifications.

Change Log Semantics

The audit trail follows standard Business Central Change Log semantics for capturing data changes:

  • When a new record is created (Insertion), the system captures only the new value in the New Value field. The Old Value field is empty.

  • When an existing record is modified (Modification), the system captures both the old and new values. Only fields where the value actually changed generate entries.

  • When a record is deleted (Deletion), the system captures only the old (final) value in the Old Value field. The New Value field is empty.

  • When multiple fields are changed in a single operation, the resulting audit entries are created in field ID order (consistent and deterministic), not in the sequence of user edits.

Only fields selected for tracking in the Field Configuration generate audit entries. Changes to fields not configured for tracking are not logged.

Retention Policy for Audit Trail

The system integrates with Business Central's standard Retention Policy framework to automatically delete historical audit records based on configurable retention periods.

  • When you configure a retention policy for the Document Change Log Entry table the system deletes records older than the specified retention period for both sales and purchase entries.

  • When you execute the Apply Manually action, the system immediately deletes records older than the configured retention period.

  • When you configure a Job Queue Entry for Codeunit 3997 (Apply Retention Policies), the system automatically deletes records on the scheduled frequency.

  • When the retention policy is disabled, historical records are preserved indefinitely.

Retention operations are logged with execution details for compliance auditing. Only audit records older than the configured retention period are deleted; recent entries remain visible and accessible.

  • On the Retention Policies page, the following fields are available when configuring audit trail retention:
FieldDescription
Table IDSpecifies the audit trail table for retention (Sales Document Change Log Entry or Purchase Document Change Log Entry).
Table CaptionDisplays the name of the selected table for reference.
Retention PeriodSpecifies the retention period. Available options include: 1 Week, 1 Month, 6 Months, 1 Year, or custom periods using the Retention Period table.
Date Field No.Specifies the date field used to determine record age. The system uses the Date Time field to calculate which records exceed the retention period.
EnabledBoolean field. When you turn on this toggle, the retention policy is active and will be applied during manual or scheduled execution.
  • To apply retention policies manually, follow these steps:

I. Select the Search iconSearch icon, enter Retention Policies, and then choose the related Table Id(72644355).

The Retention Policies page opens.

II. Select the retention policy for the audit trail table.

III. Select the Apply Manually action to execute the retention policy immediately.

All audit entries older than the configured retention period are deleted.

  • To configure scheduled retention, follow these steps:

I. Select the Search iconSearch icon, enter Job Queue Entries, and then choose the related link.

The Job Queue Entries page opens.

II. Create a new Job Queue Entry for Codeunit 3997 (Apply Retention Policies).

III. Configure the recurrence schedule (e.g., daily, weekly).

IV. Enable the Job Queue Entry by turning on the Status toggle.

It is recommended to schedule retention policy execution during off-peak hours to minimize performance impact on users.

Excel Export Details

When you select the Export to Excel action from the Change Log Entries page, the exported file includes metadata and filtered data.

  • The Date Created section displays the date when the Excel file is generated.

  • The Generated By section displays the name of the user who created the export.

  • The Company Name section displays the current Business Central company name.

  • The Applied Filters section lists all filters that were applied, including Document Type, Document No., Customer/Vendor No., Change Type, Field Name, Division, Season, User ID, and Date Range.

  • The Data Section contains all rows and columns currently displayed in the report based on applied filters.

Only visible fields are included in the export. If you have hidden fields using personalization, those fields are excluded from the Excel export.