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 :
Microsoft Dynamics AX (Archived)

Problem posting serialized item to purchase line in code, it ignores the InventDimid being received

(0) ShareShare
ReportReport
Posted on by 804

The problem is related to the setting of the inventDimId on the purchParmLine. Despite updating the purchParmLine it wants to use the purchLine inventDimId. The result is an error message saying serial number must be entered. Any ideas? In debug the purchParmTable and purchParmLine look good.

   purchTable = PurchTable::find(_purchId);
    purchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip); // move to first statement
    parmid=purchFormLetter.parmId(NumberSeq::newGetNum(CompanyInfo::numRefParmId()).num());
    parmId= purchFormLetter.parmId();
    purchFormLetter.createParmUpdate();
    purchParmtable= purchParmtable::find(_purchid,parmid);
    purchFormLetter.createParmTable(purchParmTable,purchTable);
    purchParmTable.Num = _packSlipId;
    purchParmTable.insert();

    while select firstonly purchLine
        where purchLine.PurchId == purchTable.PurchId &&
              purchLine.ItemId == _itemId &&
              purchLine.LineNum == _linenum
    {
        foundRecord = True;
        purchParmLine.ParmId = purchParmTable.ParmId;
        purchParmLine.TableRefId = purchParmTable.TableRefId;
        purchParmLine.InitFromPurchLine(purchLine);

        purchParmLine.ReceiveNow = 1;
        purchParmLine.setQty(DocumentStatus::PackingSlip, false, true);
        purchParmLine.setLineAmount();
        newDim.wMSLocationId = '5NEW';
        newDim.InventLocationId = 'PSF';
        newDim.InventSerialId = _inventSerialId;
        newDim.InventSiteId = '0101';
        purchParmLine.InventDimId   = InventDim::findOrCreate(newDim).inventDimId;
        purchParmLine.insert();

    }
    if (foundRecord)
    {
        purchFormLetter.proforma       (false);             // proforma ?
        purchFormLetter.printFormLetter(_printPack);            // print ?
        purchFormLetter.specQty        (PurchUpdate::PackingSlip);  // what to update?
        purchFormLetter.transDate      (today());           // update date
        purchFormLetter.run();
    }

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Konrad U Profile Picture
    804 on at

    Sort of figured it out on my own. Forums do not appear to be as active as they used to.

  • Community Member Profile Picture
    on at

    What was your solution?

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!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans