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, ...
Unanswered

Issue adding Non‑Inventory line to PO via X++

(0) ShareShare
ReportReport
Posted on by 20
 
Hi everyone,

After adding a non‑inventory purchase line to a PO through X++, I’m running into an issue. When I try to edit the PO, I am getting the following error:
Field 'Lot ID' must be filled in. Field 'Company' must be filled in.

I tried debugging but couldn’t identify the root cause. Am I missing something here? Any guidance would be helpful. Below is the code snippet to create purchline
 
axPurchLine = AxPurchLine::newPurchLine(purchLine);
axPurchLine.parmPurchId(purchTable.PurchId);
axPurchLine.parmProcurementCategory(category.RecId);
axPurchLine.parmName("Service Line123");
axPurchLine.parmPurchQty(1);
axPurchLine.parmPurchPrice(1000);
axPurchLine.parmPurchUnit("ea");
axPurchLine.save();
 
Also tried in this way too 
 
        purchLine.clear();
        purchLine.initValue();
        purchLine.initFromPurchTable(purchTable);
        ////purchLine.PurchId = purchTable.PurchId;
       
        ////// Non inventory line
        purchLine.ProcurementCategory = category.RecId;
       
        //// Description
        purchLine.Name = "Service Line";
 
        //// Quantity
        purchLine.PurchQty = 1; 
 
        //// Unit
        purchLine.PurchUnit = "ea";
 
        //// Price
        purchLine.PurchPrice = 1000;
        
        purchLine.createLine(
            true,
            true,
            false,
            false,
            false,
            false);
 
I have the same question (0)
  • Martin Dráb Profile Picture
    239,559 Most Valuable Professional on at
    What is the stack trace of the exception? As you see, you need to collect more information before you can know what to fix. The cause may also be caused by your customization, therefore not reproducible by others in this forum.
    Also, is this about F&O or AX?

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 April Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 620

#3
Subra Profile Picture

Subra 473

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans