Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

How can I create inventDim by code

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.

  • 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 212 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

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,339 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,177 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans