Thursday, November 6, 2025

Open in Excel is not working on DEV BOX (Microsoft Dynamics 365 SCM)

When I tried to open in Excel on the on-premise dev environment, I encountered the following issue:

Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA' | Network client threw: Failed with status 400 | Attempted to reach: 


To resolve it, I had to use web version of Excel

Then you need to upload the file that was downloaded from Microsoft Dynamics 365 SCM

Expense Report Workflow Fails with X++ Exception: Cannot create a record in Alerts - event inbox data (EventInboxData)

Description

Recently I experienced the following issue:

Expense Report Workflow Fails with X++ Exception: Cannot create a record in Alerts - event inbox data (EventInboxData) 

Steps to review the error messages: 

1. Navigate to: Expense management > Process expense reports > All expense reports (Note: user must be linked to an employee record to see the data) 

2.Create expense report and Submit it.

3. After submitting to workflow, workflow will fail.

Stopped (error): X++ Exception: Cannot create a record in Alerts - event inbox data (EventInboxData). Inbox ID: 5637144754. The record already exists.


Resolution:

Error occurs because the workflow tries to create a duplicate record in the EventInboxData table using an Inbox ID that already exists.

Resolution: Delete the inactive records from the EventInboxData table.


Additional details were found here:

Exception: Cannot create a record in Alerts - event inbox data (EventInboxData) - Dynamics 365 for operations - v23

X++ Exception issue during Workflow creation

Exception has been thrown by the target of an invocation

I have recently experienced an issue on MS 10.0.45 in Microsoft Dynamics 365 for Supply Chain Management. While posting project invoice proposal for sales order, an error message is thrown "Exception has been thrown by the target of an invocation". This issue is not reproducible on MS 10.0.43, only on 10.0.45. I have validated the same scenario on clean/vanilla F&O on MS 10.0.45 and the same issue exists.  

After debugging this issue, it is showing an error:

System.MissingMethodException: 'Method not found: 'Void Microsoft.Dynamics.Commerce.Headquarters.Instrumentation.CommerceHQEventSource.EventWritePaymentsInvoiceEndUpdateStart(Int64, System.String, Boolean)'.'

This seems to be related to the following issue:

https://fix.lcs.dynamics.com/Issue/Details?bugId=855772&dbType=3&qc=d9cbf941a333782909abd105d654b4394a74f245c259530d6d9f650effac53fa

In our case the resolution was to swap dlls with newer version. By taking dlls from "Retail" model and replacing existing in "ApplicationSuite" model. 

Wednesday, January 15, 2025

D365 SCM Moving average: High-level overview

 Moving average is a costing method that works on average principle, meaning it calculates the average cost of inventory in stock. 

Average cost of each inventory item in stock is re-calculated after receiving inventory via purchase orders or any other inbound documents. So formula is the following:

The moving average cost = the total cost of items purchased / the number of items in stock.

Let's look at the example below:


With these transactions, the moving average cost at the 9/16/2024 was 100$, but at the 9/18/2024 was 120$.
Calculation for the 9/18/2024 = (10000+18000)/(100+150) = 112
If we sell the product, the cost of goods sold would be 112$.

In the scenarios above, the sales order was posted before posting of the invoice for purchase orders
So what will happen when invoice is posted for the purchase order and invoice price has been changed. 

What happens in D365 in this scenarios.
Purchase order transaction:
Let's charge 105.00 per unit for the item, not 100.00 as it was originally in the product receipt.


When we post invoice and invoice price is different, the following voucher will be created:
If the invoiced quantity is still on hand, the full difference between the invoiced amount and the receipt is recognized as an inventory cost.
If only part of the quantity is still on hand, the system performs a proportional calculation at the time of invoicing.

In our scenario, part of the quantity was sold already. The additional cost of 5.00 per unit cannot be related to the sales order, because the sales order is already costed when you receive the invoice for the purchased items. Therefore, the system performs a proportional calculation, and the expense of 400.00 ([105.00 - 100.00] × 80 units) is expensed on the Price difference for moving average account. So 400$ expensed and the remaining 100$ will be recognized as inventory cost and Financial cost that will be posted on transaction is 10100$ instead of 10500.

Moving average cost recalculation:
As soon as we post invoice, Cost is recalculated and now, it is not 112$, but 112.59$.
The calculation is the following: (10100+18000-8960) / (100+150-80) = 112.5882 

Sales order transaction
It does not update/recalculate issue transaction, it does not post adjustment transaction. 

Inventory close does not affect products that have moving average as the inventory model group, and it does not generate any settlements between the transactions. So it means that posted sales orders will stay unchanged. 

Moving average is typically a good fit for the following scenarios: 
- All units of the same product family carry the same cost
- There is no need to recalculate the inventory transactions to adjust the costs on outbound transactions. 
- There is no need in inventory closing
- Data entry on purchase orders is accurate and in timely manner and no significant difference between purchase price and invoice price.