web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Inventory dimension Site is mandatory and must consequently be specified while creating production order in D365f0

(0) ShareShare
ReportReport
Posted on by 92

Hi,

I'm trying to create production order through code but it giving an error of "Inventory dimension Site is mandatory and must consequently be specified." even I've set the site and location.

Below is the code

ProdTable prodtable;
InventTable inventTable;
InventDim inventDim,inventDimlocal;
InventItemOrderSetupType setupType = InventItemOrderSetupType::Invent;
;

inventTable = inventTable::find(_selectedLines.ItemNumber);

prodtable.initValue();
prodtable.initFromInventTable(inventTable);

prodtable.ItemId = inventTable.ItemId;
prodtable.DlvDate = _selectedLines.RequestDate;
prodtable.QtySched = _selectedLines.Quantity;
prodtable.RemainInventPhysical = _selectedLines.Quantity;

inventDim.initValue();

inventDim.InventSiteId = '1';

// Default Location

inventDim.InventLocationId = '11';

inventDim.ConfigId = inventTable.StandardConfigId;

inventDimlocal = InventDim::findOrCreate(inventDim);

prodtable.BOMId = BOMVersion::findActive(prodtable.ItemId,
prodtable.BOMDate,
prodtable.QtySched,
inventDimlocal).BOMId;

prodtable.RouteId = RouteVersion::findActive(prodtable.ItemId,
prodtable.BOMDate,
prodtable.QtySched,
inventDimlocal).RouteId;

prodtable.initBOMVersion();
prodtable.initRouteVersion();
ttsbegin;
prodtable.insert();
ttscommit;

Anyone facing this issue or resolve this. let me know. Remember inserting and inserted method functionality do nothing.
Regards,
Zohan
I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    A good general approach to such errors is to look at the production orders that are created via D365 UI, using table browser or SQL Server Management Studio. This way you will see what good data looks like.

    Then try to write code that creates similar data.

    Seems that you don't set ProdTable.InventDimId in your code. Perhaps that causes the error.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 465 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans