Sales Order and Purchase Order Audit Trail
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 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:
| Field | Description |
|---|---|
| Table ID | Specifies 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 Name | System-populated field displaying the name of the selected table (e.g., Purchase Header, Purchase Line). This field is read-only. |
| Enabled | Specifies 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 Available | Displays 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 Insertion | Displays the count of fields configured to track Insert operations. This field is read-only. |
| No. of Fields to Log Modification | Displays the count of fields configured to track Modify operations. This field is read-only. |
| No. of Fields to Log Deletion | Displays the count of fields configured to track Delete operations. This field is read-only. |
| Filters Count | Displays the number of active filters configured for this table. This field is read-only. |
| Last Modified At | Displays the date and time when the setup line was last modified. This field is read-only. |
| Last Modified By | Displays 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:
| Action | Description |
|---|---|
| Edit List | Enables inline editing of the field configuration lines. |
| Enable All - Log Insertion | Enables the Log Insertion checkbox for all fields in the list. |
| Disable All - Log Insertion | Disables the Log Insertion checkbox for all fields in the list. |
| Enable All - Log Modification | Enables the Log Modification checkbox for all fields in the list. |
| Disable All - Log Modification | Disables the Log Modification checkbox for all fields in the list. |
| Enable All - Log Deletion | Enables the Log Deletion checkbox for all fields in the list. |
| Disable All - Log Deletion | Disables the Log Deletion checkbox for all fields in the list. |
Field Configuration - Field Descriptions
| Field | Description |
|---|---|
| Field ID | Specifies the field number within the selected table. This is the unique identifier for the field in the table schema. |
| Field Name | Displays the internal field name for reference purposes. This field is read-only. |
| Field Caption | Displays the user-friendly caption of the field as shown in the Business Central user interface. This field is read-only. |
| Field Type | Displays the data type of the field (e.g., Option, Code20, Text100, Text50, Text30, Code10). This field is read-only. |
| Log Insertion | Boolean field. When enabled, the system logs changes to this field when a new record is inserted. |
| Log Modification | Boolean field. When enabled, the system logs changes to this field when an existing record is modified. |
| Log Deletion | Boolean 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:
| Field | Description |
|---|---|
| Field ID | Specifies 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 Name | System-populated field displaying the internal name of the selected field. This field is read-only. |
| Field Caption | System-populated field displaying the user-friendly caption of the selected field (e.g., "Division Code"). This field is read-only. |
| Filter Value | Specifies 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:
| Field | Description |
|---|---|
| Audit Trail Retention Period | Specifies 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. |

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:
| Field | Description |
|---|---|
| Document Type | Specifies 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 Type | Specifies the change type filter (Insertion, Modification, Deletion and Blank). |
| Field Name | Specifies the field name filter. Enter the field name to find changes to specific fields. |
| Division | Specifies the division code filter. Filters entries to documents assigned to the selected division. |
| Season | Specifies the season code filter. Filters entries to documents assigned to the selected season. |
| User ID | Specifies the user filter. Filters entries to changes made by the selected user. |
| Date and Time | Specifies 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:
| Field | Description |
|---|---|
| Entry No. | Specifies the unique identifier for the audit entry. This is the primary key for the audit record. |
| Date and Time | Specifies the timestamp when the change occurred. The system defaults this to the system's date and time when a record is created. |
| Table Name | Specifies the name of the table that was changed (Sales Header or Sales Line). |
| Document Type | Specifies 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 ID | Specifies the user who made the change. |
| Customer No. | Specifies the customer number from the document for business context. |
| Customer Name | Specifies the customer's name from the document for reference. |
| Division Code | Specifies the division code from the document. |
| Season Code | Specifies the season code from the document. |
| Change Type | Specifies the type of change (Insertion, Modification, Deletion and Blank). |
| Field Name | Specifies the name of the field that was changed. |
| Old Value | Specifies the previous value before the change. For Insert operations, this field is empty. |
| New Value | Specifies 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:
| Field | Description |
|---|---|
| Document Type | Specifies 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 Type | Specifies the change type filter (Insertion, Modification, Deletion). |
| Field Name | Specifies the field name filter. Enter the field name to find changes to specific fields. |
| Division Code | Specifies the division code filter. Filters entries to documents assigned to the selected division. |
| Season Code | Specifies the season code filter. Filters entries to documents assigned to the selected season. |
| User ID | Specifies the user filter. Filters entries to changes made by the selected user. |
| From Date | Specifies the starting date for the date range filter. |
| To Date | Specifies 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:
| Field | Description |
|---|---|
| Entry No. | Specifies the unique identifier for the audit entry. This is the primary key for the audit record. |
| Date Time | Specifies the timestamp when the change occurred. The system defaults this to the system date and time when a record is created. |
| Table Name | Specifies the name of the table that was changed (Purchase Header or Purchase Line). |
| Document Type | Specifies 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 ID | Specifies the user who made the change. |
| Vendor No. | Specifies the vendor number from the document for business context. |
| Vendor Name | Specifies the vendor’s name from the document for reference. |
| Division Code | Specifies the division code from the document. |
| Season Code | Specifies the season code from the document. |
| Change Type | Specifies the type of change (Insert, Modify, Delete). |
| Field Name | Specifies the name of the field that was changed. |
| Old Value | Specifies the previous value before the change. For Insert operations, this field is empty. |
| New Value | Specifies 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:
| Field | Description |
|---|---|
| Table ID | Specifies the audit trail table for retention (Sales Document Change Log Entry or Purchase Document Change Log Entry). |
| Table Caption | Displays the name of the selected table for reference. |
| Retention Period | Specifies 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. |
| Enabled | Boolean 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 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 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.