Skip to main content

Notifications

Announcements

No record found.

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

  • Noob_Man Profile Picture
    Noob_Man 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
    Dhruv R Thakar 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
    Community Member Microsoft Employee 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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,661 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans