The InterRadish Blog

WMS only mode - Postman configuration and integration example (3/5)

configuration warehouse only mode Sep 25, 2023

Back to the learning center

In order to be able to use the warehouse management only mode, inbound and outbound shipment messages must be created outside the system (e.g. external ERP) and received in D365 for further processing.

Microsoft offers a couple of suggestions for this which you can read more about at: Example of using inbound and outbound shipment orders - Supply Chain Management | Dynamics 365 | Microsoft Learn.

One of these options is to use Postman which I will be using in my demo as well. This is therefore a step-by-step guide on how to set up the Postman to use this new WMS mode.

In short, we need to do the following:

  1. Install Postman.
  2. Acquire OAuth authentication token.
  3. Create and send a shipment order message header.
  4. Create and send shipment order message lines.
  5. Commit the shipment order message (this will flip it to Received status in D365).
  6. Process it in D365 (get the status Accepted) which creates the shipment order we can use for further processing within the WMS.

For the purpose of this guide, I will use the inbound shipment order message example, but the process is exactly the same for the outbound messages.

I am also using the provided JSON messages from Microsoft: Example of using inbound and outbound shipment orders - Supply Chain Management | Dynamics 365 | Microsoft Learn.

Let's see this in more detail now.

Download and install Postman

You can find the application here: Download Postman | Get Started for Free. Log in or register an account. They also offer an alternative to use Lightweight API client without registration, which is sufficient for this test.

Create a new App registration in Microsoft Entra ID

This is the same process as if you were configuring the WMS mobile app. Add the registration in your environment while assigning it the Admin user. This will enable communication between Postman and D365 so the messages can be received.

NOTE: you can reuse the same app registration for the WMS app if needed, but the permissions must be Admin (User Id = Admin).

Dynamics Warehouse management only mode

Requesting the authentication token

Once Postman is installed, we should first get the authentication token ready. Do this by selecting the + sign to create a new tab in the top section. Specify the details as shown in the picture below. These are your Microsoft Entra ID app details:

Hit Send (step 3 above) – this will now return the Bearer token value in the bottom section of the form. Then copy the token value (blurred value in step 4 above) excluding the parenthesis at the beginning and the end. You will need this token value for the authentication of further messages.

Have in mind that by default the token expires every hour or so. If this happens, you can hit Send again and you will get a new token. You must then use this new token to send further messages, otherwise an authentication error will be shown.

Create the shipment order header message

Select the + sign to create a new tab and follow the steps below.

This time, create a POST request and add the URL in the field next to it:

In the Authorization tab, select Type=Bearer Token and paste the Token value into the field on the right.

In the Headers section add Key=Content-Type and Value=application/json.

In the Body section, select it to be raw and paste the JSON message and add the desired details. One MessageId can have multiple OrderNumber associated. It is expected in a live scenario that each message would contain a batch of orders being processed together.

{
"MessageId": "{{MessageId}}",
"dataAreaId": "{{dataAreaId}}",
"SourceSystemId": "{{SourceSystem}}",
"OrderNumber": "{{OrderNumber}}",
"ReceivingWarehouseId": "{{Warehouse}}"
}

Press Send once ready and if everything is OK, a confirmation will be shown in Postman, as well as the message header will be present in D365.

We see here the message header present in D365 as a result of this.

We can also see the related message details, for which there are currently no lines displayed.

Create the shipment order lines message

Now it’s time to add some lines to the header message we just did. Select the + sign to create a new tab and follow the steps (see screenshot below for more details):

  1. The first three steps are the same as with the outbound header message. So go ahead and create a new tab for a POST request, the Authorization, and Headers sections. Fill it with the same values.
  2. The URL must be changed to:
    1. This will identify that this message is for the lines.
  3. In the Body, add the JSON message of the lines and add the correct values. Press Send once done and confirm the message was sent correctly and is in D365.  

{
"MessageId": "{{MessageId}}",
"dataAreaId": "{{dataAreaId}}",
"SourceSystemId": "{{SourceSystem}}",
"OrderNumber": "{{OrderNumber}}",
"OrderLineNumber": {{LineNum}},
"ItemNumber": "{{ItemId}}",
"ExpectedQuantity": {{qty}},
"ExpectedUnitSymbol": "{{UoM}}"
}

 As a result, the message order line is now created in the message header.

You can add more lines to the message order by repeating the sending of the message, but making sure the details are changed correctly. The line number must be unique otherwise an error will be shown.

Committing the message

The message is still in Receiving status. We must commit the message via Postman as well to change the status to Received. Once that is done, the Message processor will be able to process it and create the Shipment order.

Select the + sign to create a new tab and follow the steps below.

Define the new tab as POST and add the URL value below.

https://YOUR-ENVIRONMENT-URL.axcloud.dynamics.com/data/InboundShipmentOrderMessages(MessageId='{{MessageId}}',dataAreaId='{{dataAreaId}}',SourceSystemId='{{SourceSystemId}}',OrderNumber='{{OrderNumber}}')/Microsoft.Dynamics.DataEntities.Complete?cross-company=true
  • MessageId must match your message ID from the header and lines messages.
  • dataAreaId must match your legal entity in D365.
  • SourceSystemId must match the source system ID from D365 and the messages sent.
  • OrderNumber must match the order number specified in the messages.

In the Params section define the key as shown:

In the Authorization section add the Bearer token:

Press Send. This will now commit the message in D365 and change the status to Received:

Processing the message

We can now process the message in D365 and create an Inbound shipment order. We can process it manually by selecting the Process button or via batch job:

Once the processing is done, the status of the ISO, or the inbound shipment order, message is changed to Accepted:

A shipment order is created in status Open and is ready to be processed further:

We can use this procedure to relatively easily create the ad-hoc message for testing and demo purposes.

Outbound

For creating outbound shipment messages, the same principle applies as with the inbound messages, but with a few differences:

Token authorization

Use the same process.

Outbound shipment order (header) message

Change the URL to:

Change the JSON text to:

{
"MessageId": "{{MessageId}}",
"dataAreaId": "{{dataAreaId}}",
"SourceSystemId": "{{SourceSystem}}",
"OrderNumber": "{{Order Number}}",
"ShipFromWarehouseId": "{{Warehouse}}",
"ConsigneeName": "{{ConsigneeName}}",
"ConsigneeCountryRegionId": "{{ConsigneeCountryRegionId}}"
}

Outbound shipment line order message

Change the URL to:

JSON remains almost the same as for the inbound side:

{
"MessageId": "{{MessageId}}",
"dataAreaId": "{{dataAreaId}}",
"SourceSystemId": "{{SourceSystem}}",
"OrderNumber": "{{OrderNumber}}",
"OrderLineNumber": {{LineNum}},
"ItemNumber": "{{ItemId}}",
"OrderedQuantity ": {{qty}},
"OrderedUnitSymbol": "{{UoM}}"
}

Committing the message

Change the URL to: 

https:// https://YOUR-ENVIRONMENT-URL.axcloud.dynamics.com/data/OutboundShipmentOrderMessages(MessageId='{{MessageId}}',dataAreaId='{{dataAreaId}}',SourceSystemId='{{SourceSystemId}}',OrderNumber='{{OrderNumber}}')/Microsoft.Dynamics.DataEntities.Complete?cross-company=true

You should now have the inbound and outbound shipment order message created in D365 as well. We'll continue with processing the messages and creating the shipment orders in D365 in the next post here.