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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How can I create inventDim by code

(0) ShareShare
ReportReport
Posted on by

Hello,

I have to create inventdim by code in a job.

But, systematicaly, AX send an error : "the inventDimId already exists" but this inventdimid don't exist.

What I have to do ?

When I use the standard methode "findorcreate", dynamics send me invendim where inventdimId is "Allblank". but I don't want the allblank.

 

Can you please help me ?

 

Thanks by advance.

*This post is locked for comments

I have the same question (0)
  • Noob_Man Profile Picture
    10 on at
    RE: How can I create inventDim by code

    InventDim inventDim

    PurchLine _purchLine

    //then write below

    inventDim.inventSiteId = "MainSite";

    inventDim.inventLocationId = "Main_WH";

    inventDim.inventSerialId = "random_value";

    inventDim.inventDimId = inventDim::FindOrCreate(inventDim).inventDimId;

    // then from your excel while importing values from file into PO lines i.e. purchline

    Select for update _purchLine

    ttsbegin;

    _purchLine.InventDimId = inventDim.inventDimId;

    _purchLine.insert();

    ttscommit;

  • Suggested answer
    Dhruv R Thakar Profile Picture
    214 on at
    RE: How can I create inventDim by code

    Recently i came across a requirement, where i  need to create or find Invent Dim records by passing item attributes. You can check below link for the same type of requirement.

    [View:https://dhruvrthakar.blogspot.com/2018/04/create-or-find-invent-dim-in-ax-2012.html:750:50]

    If the post is helpful in that it provides the solution, please mark as verified to help other members...

  • Suggested answer
    Community Member Profile Picture
    on at
    Re: How can I create inventDim by code

    Hi,

    Me, I use the following code in a job (becarefull, it depends of stock dimensions) :

                           inventDimConfig.clear();

                           inventDimConfig.wMSLocationId    = _wMSLocationId;

                           inventDimConfig.InventLocationId  = _InventLocationId;

                           inventDimConfig.configId                 = _StandardConfigId;

                           inventDimConfig.wMSPalletId         = _wMSPalletId;

                           inventDimConfig = InventDim::findOrCreate(inventDimConfig);

    Best regards

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
KP-31070522-0 Profile Picture

KP-31070522-0 3

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans