#NAVdevInfo 7: Block Item – more possibilities?
Today I was checking the Item table in the Business Central on-prem version and spotted something new (?). Why question mark? This is because I see that the functionality: Block Inventory for Sales and Purchase is on Microsoft Docs since… 2017. But I checked Dynamics NAV version 2017 and version 2018 (some latest CUs) and cannot see it there.
What kind of options we have?
From a long time there was only one possibility to block Item – one field on Item Card to Block Item. True or False – nothing more.
Now I can see two (new) fields Sales Blocked and Purchasing Blocked and they are working without relation to the existing one. First one you can find on Prices & Sales and second on Replenishment FastTab.
When you would try to put on sales or purchase document the Item which is blocked in new way then you will got an error that it is blocked for sales or purchase.
The same would happen if you try to put line to Item Journal:
It is also checked when you posting sales shipment or purchase receive, so if someone changed the field after putting the item to the document or to the journal it also will not be possible to post the item ledger entry.
How does it work from code point of view?
The fields are created in 8000 numbers (if still you need to know as in AL it does not matter so much anymore). Then code is added in the functions CopyFromItem in table Sales Line and Purchase Line (example below is from Sales Line).
Additionally there is very similar code in Codeunit Item Jnl.-Post Line in function PostItem.
Here you can find documentation for that function:
https://docs.microsoft.com/en-us/dynamics-nav-app/localfunctionality/switzerland/how-to-block-inventory-items-for-sales-or-purchases
Other options for blocking?
I know that it in some cases that would not be enough. Some customers need more options such as blocking for production, assembly, transfer etc. Also sometimes it can be needed to block not on item level but on location level. Hopefully we will have in standard such possibility in future.
However if you already need such thing let me know – I think I can help you with that.