Business Central Item Attribute History 1.0

Mar 12, 2023
#business-central

Announcing the release of a Microsoft Dynamics 365 Business Central extension to record item attribute changes.

Context

A client I’m working with uses Business Central in a way that could surprise its Microsoft product managers.

While the ERP software offers multiple ways to automatically calculate an inventory item’s COGS (Cost of Goods Sold) price (Average, LIFO, FIFO, …), this company uses a distinct formula computed by hand. Resulting values are stored as item attributes:

Custom COGS Price attribute on item
Custom COGS Price as an attribute on the Item Card

Business Central doesn’t make much out of these custom values. In particular, it only ever keeps the latest value set on an item. This means that when a COGS price calculation changes (which it does, and often!) and the attribute is updated, the previous value gets lost!

Whether this is a problem generally depends on the nature of these custom values. In this case, past item COGS values are critical to accurate historical reporting of measures such as inventory value & profit margins.

A solution based on Business Central’s extensibility

Extending Business Central enables realtime detection of item attribute changes, including new additions, modifications and deletions. Once detected, a change can be recorded in a database table and made available for consulting via the web client and an API query.

1
2
3
4
5
6
7
    [EventSubscriber(ObjectType::Table, Database::"Item Attribute Value Mapping", 'OnAfterInsertEvent', '', false, false)]
    procedure OnAfterMappingInsert(var Rec: Record "Item Attribute Value Mapping")
    var
        HistoryManager: Codeunit "Item Attribute History Manager";
    begin
        // Save using HistoryManager
    end;

This is what the Item Attribute History extension accomplishes. Out of the box, it provides:

A Business Central Page

Item Attribute History Page
Item Attribute History Page, accessible through search

A Business Central Query

Item Attribute History Query
The API Query as seen from Power BI

Closing notes

For implementation details and installation instructions, refer to Item Attribute History (github.com).

Additional help is available if needed.