D365 Business Central : The Mysterious Case of Bin Content Quantity

I was working on getting inventory availability using Bin Contents and for some reason, I could never get the correct quantity for each Bin.

Bin Contents

Quantity field in Bin Content is a FlowField which means the field is not a physical field. It is calculated when needed from Warehouse Entry.

Quantity is related to the Unit of Measure. Quantity (Base) is related to the Base Unit of Measure. In the above example:
1 BOX = 12 EA, so Quantity : 1 BOX = Quantity (Base) : 12 EA.

FlowField

Let’s try creating simple action to show the Quantity on the Bin Contents page.

addlast(Processing)
        {
            action(MessageQty)
            {
                Caption = 'Message Quantity';
                ApplicationArea = All;
                trigger OnAction()
                begin
                    Rec.CalcFields(Quantity);
                    Message('Quantity : %1', Rec.Quantity);
                end;
            }
        }

If I run the above code, the message actually shows 12 which is Quantity (Base), not Quantity. Why ?

Quantity field is a FlowField, so I decided to take a look at the table Warehouse Entry directly. Surprisingly, the Quantity and Quantity (Base) have the exact same value, even though the record is not in Base Unit of Measure.

How come the page show the correct quantity though ? It turns out that on the Bin Contents page, BC actually recalculates the Quantity from Quantity (Base). The table field Quantity itself is not being used on the page.

Why is it designed this way ? No idea. Just be aware when you are using Bin Content Quantity.

thatnavguy

Experienced NZ-based NAV Developer and Consultant with 15+ years of experience leading multiple IT projects, performing business analyst, developing, implementing, and upgrading Dynamics NAV and Business Central. Passionate to deliver solution that focuses on user-friendly interface while keeping high standard of compliance with the needs.

You may also like...

1 Response

  1. 23 December 2021

    […] The Mysterious Case of Bin Content Quantity […]

Leave a Reply

Your email address will not be published. Required fields are marked *