Dissecting the Warehouse Management app layout

Dissecting the Warehouse Management app layout

The layout of the Dynamics 365 Warehouse Management app is managed by both the App code and the D365 SCM core to ensure a productive workflow. The app receives a state from the Dynamics 365 SCM core encapsulated in a “container,” comprising a list of controls to be presented on the current screen. These hints include the DisplayArea  assignment (the display area where controls that are awaiting input or confirmation are found, see Inspect details of active Warehouse Management mobile app sessions – Supply Chain Management | Dynamics 365 | Microsoft Learn) and the InstructionControl reference for item ID, quantity, location confirmations.

Typically, controls without default values are positioned in the Primary Input Area, awaiting user input through scanning or manual entry. In the above example, the next empty control is LP (license plate) i.e. the licence plate to pick the goods from. These controls which require a user input are presented one after another following the order of controls in the “container” or the explicit Display Priority, if provided by the programmer of the warehouse menu item UI. This is perceived by the user as a series of screens; internally, it remains the same screen.

To determine the DisplayArea, the D365 core employs heuristics. Controls with default values slide down to the Info and Secondary Input Area, except for confirmation fields like Confirm Location, which appear in the Primary Input Area despite seemingly having a default value. The initial value is still empty, but the InstructionControl let the warehouse app present a hint from a different field and display it in italic (here: BULK-010).

Upon assigning values to all controls, the screen is considered complete, triggering the button in the Primary Action Area.

Control placement on the Warehouse Management app screen can be influenced through the WHSMobileAppServiceDecoratorRule class family. For instance, a control with a non-empty default value can still be prompted in the primary input area, as demonstrated in the below code snippet:

				
					[SubscribesTo(classStr(WHSMobileAppServiceDecoratorRuleDefaultDisplayArea), staticDelegateStr(WHSMobileAppServiceDecoratorRuleDefaultDisplayArea, isTextInPrimaryInputAreaDelegate))]
public static void WHSMobileAppServiceDecorator_isTextInPrimaryInputAreaDelegate(boolean _enabled, Map _controlMap, str _data, WHSMenuItemName _menuItemName, EventHandlerResult _result)
{
   if (_enabled && _controlMap.lookup(#XMLControlName) == #MyControl)
   {
      _result.result(true);
   }
}
				
			
It is important to remove (to be exact, not to rebuild after the last user interaction) such a control from the screen once it receives its input, otherwise it will be prompted repeatedly in an infinite loop. The second example showcases a custom control with an InstructionControl reference for requesting confirmations while presenting a hint in italic:
				
					[ExtensionOf(classStr(WHSMobileAppServiceDecoratorRuleInstruction))]
final class WHSMobileAppServiceDecoratorRuleInstruction_Extension
{
    #WHSRF
    protected WHSMobileAppControlName getInstructionControlName(WHSMobileAppControlName _controlName)
    {
        WHSMobileAppControlName confirmationControl = _controlName;
        WHSMobileAppControlName masterControl;
        masterControl = next getInstructionControlName(confirmationControl);
        if (confirmationControl == #MyControl)
        {
            masterControl = #MyMasterControl;
        }
        return masterControl;
    }
}
				
			

How NOT to send an order confirmation per e-mail

How NOT to send an order confirmation per e-mail

When utilizing configurable business documents (Electronic Reporting) in Dynamics 365, additional steps are required to dispatch various documents such as invoices, delivery notes (referred to as packing slips in the US), sales order confirmations to customers, or purchase order requests to suppliers. Begin as usual with Accounts receivable > Setup > Forms > Form setup, Print management. Select the appropriate Electronic Reporting (ER) configuration as a Report format.

It’s important to note that the conventional flexible print destinations outlined in Set up print management for a module | Microsoft Learn are not applicable for ER reports. Instead, navigate to Organisation Administration > Electronic Reporting > Electronic reporting destination. Here, for each ER configurable business document, create a dedicated line where you can specify Email as the destination under the Settings.

Programmable e-mail recipients

Here’s where it gets interesting: for each From, To, Cc address, clicking Edit provides you with the flexibility to choose between the traditional hard-coded method of extracting business party account details (+Add, Print Management email) or the Configuration email, featuring a low-code ER formula. When opting for the latter choice, Electronic Reporting grants access to the corresponding ER model.

The From formula can be a simple hardcoded text with the unattended e-mail address: "noreply@erconsult.eu".  The mails will be sent via SMTP on its behalf, thus it must be a true Exchange 365 account.

The To = @Business@ field is employed to choose one among several electronic contact addresses (emails) of the party based on the electronic address Purpose. This configuration remains consistent with the classic Print Management setup.

For the Email source account for the To e-mail address, consider the following examples:

Configurable Business Document Party ER Formula to extract the account number
Sales order confirmation Customer model.SalesConfirm.BuyerCustomerParty.Party.PartyIdentification.AccountNumber
Sales order packing slip Customer Missing in the mapping; modify model.BuyerCustomerParty
Sales invoice Customer model.InvoiceBase.InvoiceAccount.AccountNum
Free text invoice Customer model.Customer.AccountNum
Collection letter note Customer model.AccountingCustomerParty.AccountNum
Purchase order Supplier model.PurchaseOrderInquiry.SellerSupplierParty.Party.Reference

The subject of the email can either be set as a fixed value, such as “Lieferschein / Delivery note” or dynamically constructed from components of the document model. This dynamic approach is particularly useful for the Body of the email. The FORMAT function with placeholders does not work. Instead, HTML tags must be concatenated sequentially. Thank you Ludwig Reinhard for this hint. Here is a sample:

"Dear Ladies and Gentlemen,"&"<br>"&"Attached you may find invoice "&model.InvoiceBase.Id&” for your order"&model.InvoiceBase.SalesId&".”&"<br>"&"Best regards, XXX"

Reprint documents safely

In the described setup, Dynamics 365 will automatically dispatch your configurable business documents to your business partners via email every time, even if you attempt to reprint or review the invoice, order confirmation, etc. The customers and suppliers will go nuts. Fortunately, a solution has been introduced since 2021: a feature known as Configure action-dependent ER destinations – Finance & Operations | Dynamics 365 | Microsoft Learn. This feature responds to the button clicked by the user—whether it’s ‘Copy,’ ‘Original,’ or ‘Use Print Management‘—and redirects the document to a different destination, providing a more controlled document distribution process.

With the configuration shown below, reprinted copies of an invoice are directed exclusively to the screen. The ‘View‘ option corresponds here to the buttons Copy preview and Original preview. The ‘Print‘ action is initiated during every post-and-print action when the configurable document is initially generated. Additionally, the ‘Print‘ action is triggered when the user deliberately selects Use print management for reprinting.

Do not send pro-forma documents to your business partners

The electronic reporting destinations unfold their devious nature when the people first preview a document before sending. Dynamics 365 is going to send the document via email regardless of whether the user opts to Use print management or not, proforma or not a proforma.  Namely, both generating a pro-forma sales order confirmation and posting a final sales order confirmation are considered Print actions. This aspect bears potential legal consequences.

The recent feature, “Allow ER destinations adjustment at runtime (Phase 2)“, introduced in version 10.0.36, may offer assistance. However, I consider it intrusive and unsafe as it opens an additional dialog window placing the decision-making in the hands of the user: humans make mistakes.

We’ve identified a somewhat unconventional but more straightforward solution by manipulating and corrupting the Email source account mentioned earlier. Consider the following example:

IF(LEN(model.InvoiceBase.Id)>0, model.InvoiceBase.InvoiceAccount.AccountNum, "FUBAR")

If the invoice number is empty, the system returns a fabricated account number; otherwise, it returns the legitimate account number.

When attempting to send a copy of a pro-forma invoice to the customer’s email address, an exception will be raised, stating, “The email address in the To field is not valid.” The Screen destination will still succeed despite this exception.

Picking list journal: Inventory dimension Location must be specified

Picking list journal: Inventory dimension Location must be specified

One – if not the – notorious error in Dynamics 365 related to production and warehouse management manifests itself at the “Production floor execution” terminal during reporting as finished (RaF). On the screen, the error message “An error occurred while processing the job…” is displayed.

In the activity center, you receive the following detailed error message:

  • Posting – Picking list journal
  • Inventory dimension Location must be specified.

This is due to the failed material withdrawal following the Finish backflushing principle (actual quantity = planned quantity, see The case of a missing flushing principle). The causes are diverse, with the most common being an incomplete warehouse work. This means that the materials haven’t been brought to the machine’s input location, yet someone is trying to report the finished or semi-finished product as complete.

This error pops up very often during the testing phase of the Dynamics 365 implementation. You may say: “Hey, let them finish the picking work first; this may never happen in real life, since the materials are going to be missing for the assembly! The sequence of production steps must be adhered to!”

It is not that simple. I’d say we are talking about a significant design flaw in the Dynamics 365 for SCM system.

Let’s conduct a thought experiment. In an MTS (make-to-stock) scenario, imagine 3 production orders planned for the same product on the same day. All of them get released at once early in the morning, all of them produce warehouse work for the picking of the same raw material. If they are not consolidated into one production wave, it may happen that the warehouse work for the PO3 has been completed much earlier than the warehouse work for the PO1, but the PO1 is started and finished earlier. There is namely no particular order or priority in the warehouse work. The material is going to be at the inbound location of the work centre, the machine operator does not care if it’s for the current or for the next order. Yet reporting the progress at the terminal fails due to the mis-allocation of the material.

Explanation

Presuming the Automatic BOM consumption parameter in Production control > Setup > Manufacturing execution > Production order defaults is set to Flushing principle, and the Post automatically is set to Yes, then the material consumption becomes an integral part of every RaF transaction at the Production floor execution terminal. If the picking list posting fails, the whole transaction is rolled back:

In reality, it is even worse than a clean rollback. On each failed attempt of Progress reporting, a new picking list journal is created. The mere presence of such a picking list prevents any further attempts because the open line(s) in the picking list journal block a portion of the bill of materials through a TransChildRefId identifier – a relationship between the journal line and the BOM line.

With the advanced Warehouse management in Dynamics turned on, the warehouse locations in the master BOM must remain empty. They are allocated during the Release or Release to warehouse phase in Production. If the Resource consumption checkbox is set in every BOM line, then the input location of the work centre is evaluated by the Warehouse management module at the run time as the picking list journal lines are getting created. While doing do, for some reason they are looking for the location in the picking warehouse work. If the particular inbound location is not reserved there in the InventTrans, or the work is not closed yet, the Location dimension in the picking journal is going to be empty:

Troubleshooting

The troubleshooting steps are as follows:

  1. First and foremost, search for any open picking lists for the production order with the button View / Journals / Picking List.
  2. Alternatively, use the list of all open picking journals in the menu Production control > Adjustments > Picking List using the order number. This list should actually be empty, meaning all picking lists should have been posted.
  3. Select the open (not posted) picking list journals and delete them all at once.
  4. Look for any open warehouse work for production, meaning the warehouse work for materials picking: Pick at the main warehouse, Put to the inbound location of the machine. Use the button Warehouse / General / Work details at the production order.
  5. If there is open work, ensure it is processed on the mobile device.
  6. If there is no open warehouse work for the production order, initiate the warehouse picking process again using the button Release to warehouse. A new production wave will be generated, and new warehouse work will be created in the background. If the materials and parts are already at the machine’s location, this warehouse work will automatically be closed, and the materials will be reserved at that location for the production order. The next picking list will have the correct location in all lines, and posting this entry will likely work.
  7. This deals with the racing condition in the above thought experiment, too: the material already found at the location will be rearranged to the current order. However, any open warehouse work for the current order shall be cancelled first. This re-release of released orders may also be automated.
  8. If the report as finished continues to fail at the terminal, the operator may forcefully reduce the quantity using the Adjust material button: click on Adjust material, enter a zero. Repeat this process for all BOM lines. Then confirm the Adjust material screen with OK. Reporting as finished should work now, while the excess material can be eliminated in a manual picking list journal.

If the error happens often, some drastic measures may need to be taken. The point in time for the consumption of materials must namely be changed to At location for most materials and parts. This de-couples the material backflushing from the Report as finished feedback.