Dynamics 365 Business Central API error handling: Application_DialogException (You must first set up user xxxx as a warehouse employee.)

Dynamics 365 Business Central

Hi, Readers.
Today I would like to share an error handling of Business Central API, Application_DialogException (You must first set up user xxxx as a warehouse employee.)
The following test is from Postman:

    “error”: {
        “code”: “Application_DialogException”,
        “message”: “You must first set up user ZY DEMO as a warehouse employee.  CorrelationId:  3283aad1-7f71-4180-815a-259cb717a494.”

I’ve been asked this question several times recently. To be precise, this is not an API error, it’s an application control. But it’s handled a bit peculiarly.
This is an error that occurs with APIs related to warehouse functionality. Since the Warehouse APIs are not included in the standard APIs, you need to customize new APIs or use Web Services if you need to integrate the Warehouse functionality with an external system.

As you might know, you must set up each user who performs warehouse activities as a warehouse employee and assign them 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. More details: Set Up Warehouse Employees
For exmaple, when you open the Warehouse Shipment page:

You can see the prompt below.

You must first set up user ADMIN as a warehouse employee.

Do you want to do that now?

If you choose No, the same error as in Postman will pop up.

So before we use Warehouse functionality, we must have to add warehouse employees first.

PS: Business Central 2023 wave 2 (BC23): Quickly set up warehouse employees (New ‘Add me as Warehouse Employee’ action)

This is the same in APIs, you can find this control in codeunit 7302 “WMS Management”.

So the solution to the question is also very simple, just set up Warehouse Employees. But why is there this problem? Because when selecting the user, it can’t find the user prompted in the error message😑.
For example,

Select from full list:

Of course it cannot be found in the user list.

If we want to find this user, we need to open Microsoft Entra Applications (Azure Active Directory Applications) page.
PS: Using OAuth to connect Business Central APIs and Web Service in Postman

Then open the application for OAuth, you can find the User Name.

This user was added automatically when the new Microsoft Entra Application (Azure Active Directory Application) was enabled.
PS: This problem did not occur during the previous basic authentication.

This user can also be found in the User (2000000120) table and the License Type is Application.

Let’s go back to the Warehouse Employees page, even if there’s no way to select to, this works if you manually enter it😑.

Back in Postman, you’ll see that the error has been resolved.

Great, I hope it will give you some help when you encounter this problem.

1. Troubleshooting OData/API calls

2. Troubleshooting web service errors


Hope this will help.

Thanks for reading.



Copied title and URL