Hi, Readers.
Today I would like to talk about a question that is often asked, how to block/disable locations in Business Central.
Locations are places such as warehouses where you buy, store, or sell items. Business Central uses locations to help keep track of inventory in both simple and complex warehouse processes.

You can then create document lines for a specific location, view availability by location, and transfer inventory between locations.

PS: Dynamics 365 Business Central: Define default location for sales or purchase
But there is a small problem here. As of the current version BC25.3, Locations does not have the Block feature.

For example, we can block items and item variants from being entered on lines in sales or purchase documents, and you can block them from being posted in transactions. More details: Dynamics 365 Business Central: How to block items (Block, Sales Blocked, and Purchasing Blocked)

But we can’t block locations. So how do we deal with unused locations? In this blog, I will introduce four general methods, hoping to give you some help.
Delete Inventory Posting Setup & Warehouse Employees
This is the most widely used work-around. On the Inventory Posting Setup page, we can set the number of the G/L account that item transactions with the combination of location and inventory posting group are posted to.

If you select a location that does not have an Inventory Posting Setup set up in document lines, the following notification is displayed first.
Inventory Account is missing in Inventory Posting Setup.

Then the following error will occur during posting.
Inventory Account is missing in Inventory Posting Setup Location Code: NEW, Invt. Posting Group Code: RESALE
In Sales Order:

In Item Journal:

PS: Please make sure that all details and cost adjustments have been posted before deleting the settings
The second point is to delete the Warehouse Employees. Each user who performs warehouse activities must be set up as a warehouse employee and assigned to a default location. Business Central filters warehouse activities to the employee’s default location. They can only perform the warehouse activities at the location. You can also assign a user to other locations. They can access but not perform activities at those locations. More details: Set Up Warehouse Employees

For example, if we create a Warehouse Shipment from an sales order, and Warehouse Employee is not set, the following message will occur.

To open warehouse document for location SILVER, You must first set up user ADMIN as a warehouse employee.
Do you want to do that now?

If you select No, the following error will be displayed.
To open warehouse document for location SILVER, You must first set up user ADMIN as a warehouse employee.

So when restricting users to use locations in warehouse management features, you can just delete Warehouse Employees.
Use Security Filters
For record-level security in Business Central, you use security filters to limit a user’s access to data in a table. You create security filters on table data. A security filter describes a set of records in a table that a user has permission to access. More details: Dynamics 365 Business Central: Using Security Filters and SecurityFiltering Property
Let’s look at a simple example, I created a new Permission Set first.

Include a standard permission set, such as D365 BUS PREMIUM.

Select Type=Include, Object Type=Table Data, Object ID=14 in Permissions (table 14 Location).

In the row for the table data to which you want to add a security filter, select the Security Filter column to open the Table Filter page.

In the Table Filter page, in the Field Number column, select the field on which you want to limit a user’s access. And then in the Field Filter column, enter the value of field that you want to use to limit access. For example: Location.Code <>NEW&<>SILVER: (Hide NEW and SILVER)
PS: Dynamics 365 Business Central: Entering Criteria in Filters (Not equal to multiple criteria)

Record level security filters do not support wildcard characters. This means that you cannot use * and ? in the filters. You can use other symbols, delimiters and, operators, such as, <, >, |, &, .., and =. If you do not enter an operator, then the default operator = is used.
Done.

Then assign the permission set to the user.

Test:
Locations:

Item Journals:

Generally, the first and second methods are combined to control the user’s use and visibility of locations.
Customization
If you want to be more thorough, you can also consider customization. For example, add a Blocked field to table 14 Location. This method is not recommended because it requires too much work. This is not a simple problem that can be solved by simply adding a field. Any place where the location table is used needs to be customized. And the standard does this through the TableRelation Property, which has some limitations when extending it.

The TableRelation property can be modified through a table extension. Modifications to the TableRelation are additive and evaluated after the existing value.
https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-tablerelation-property?wt.mc_id=DX-MVP-5004336
More details: Dynamics 365 Business Central: Can we extend TableRelation Property through a table extension??? (Yes, But…)
Let’s look at a simple example. First, add the field. This is pretty straightforward.



If you simply extend it like below, this will not work because of the limitations mentioned above.


So we have two options. One is to determine whether it is blocked after the user inputs.


But this method cannot hide Blocked locations.
The second way is to add a new location field and hide the standard location field.



The disadvantage of this method is also obvious. It requires similar customization for all standard location fields……
It would be great if Microsoft could add this to the standard.
PS: Missing a feature? Post or vote for ideas on: aka.ms/BCIdeas
Delete unused locations
In fact, you can always delete a location as long as it is not used.

There are the following controls when deleting.
You cannot delete the %1 %2, because they contain items.
You cannot delete the %1 %2, because one or more Warehouse Activity Lines exist for this %1.
You cannot delete %1 because one or more stockkeeping units exist at this location.
You cannot delete %1 because there are one or more ledger entries on this location.
For example,

Once the above restrictions are eliminated, the location can be deleted.


And this has no impact on posted (historical) data, such as Item Ledger Entries and Value Entries.


This should be the default behavior, but note that the location no longer exists. Of course, you can always add it back.
PS: Dynamics 365 Business Central: How to bulk delete data on a list page that includes a Card page (For example, bulk delete items on the Item List page)
That’s all. Give it a try!!!😁
END
Hope this will help.
Thanks for reading.
ZHU
コメント