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

Problems While Creating a Production Order with X++ code in D365 FO

(0) ShareShare
ReportReport
Posted on by 625

HI  All,

I am using the following code to create a production Order : 

    ProdQty         qty     = 100;
    ItemId          item    = 'XXXX';
 
    ProdTable       prodtable;
    InventTable     inventTable;
    InventDim       inventDim;
    ;
 
    // Initialize InventTable
    inventTable = inventTable::find(item);
 
    // Initialize the base values
    prodtable.initValue();
    prodtable.initFromInventTable(inventTable);
 
    prodtable.ItemId                = inventTable.ItemId;
    prodtable.DlvDate               = today();
    prodtable.QtySched              = qty;
    prodtable.RemainInventPhysical  = qty;
 
    // Initialize InventDim (Obrigatory)
    inventDim.initValue();
 
    // Set the active BOM and Route
    prodtable.BOMId = BOMVersion::findActive(prodtable.ItemId,
                                             prodtable.BOMDate,
                                             prodtable.QtySched,
                                             inventDim).BOMId;
 
    prodtable.RouteId = RouteVersion::findActive(prodtable.ItemId,
                                                 prodtable.BOMDate,
                                                 prodtable.QtySched,
                                                 inventDim).RouteId;
 
    // Initialize BOMVersion
    prodtable.initBOMVersion();
    // Initialize RouteVersion
    prodtable.initRouteVersion();
 
    //Use ProdTableType class to create the production order
    prodtable.type().insert();
 
    // Inform Production Order Id
    setPrefix( 'Production Order');
    setPrefix( 'Production Order Number');
    info(prodtable.ProdId);


But the problem is in D365 FO, insert() is obselete, so i tried it with inserting() and Inserted() both, but still i am not able to create a production order sucessfully.

Can someone pls help!

Thanks i Advance

I have the same question (0)
  • Verified answer
    WillWU Profile Picture
    22,363 on at

    Hi AXBOY,

    ProdTableType.insert() is deprecated.

    You could use ProdTable.insert() to insert records.

  • AXBOY Profile Picture
    625 on at

    I tried ProdTable.insert() too, but i am getting the following error which i am not able to resolve : 

    pastedimage1589186975714v1.png

  • AXBOY Profile Picture
    625 on at

    OKay it worked, with keeping the code inside ttsbegin and ttscommit.

    Thanks

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!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans