Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Answered

Create Production Picking List Journal through code in D365

Posted on by 430

Hi Experts,

I want to create picklist journal through code in D365 and also I want to create this through release button of the production order.

Also generate the print picklist report.

Please suggest the right path to achieve the same.

Regards

Sona Jee

  • Verified answer
    WillWU Profile Picture
    WillWU 22,350 on at
    RE: Create Production Picking List Journal through code in D365

    Hi Sona,

    Check the following code:

    static void PickingListJournal(Args _args)
    {
        ProdJournalTable    prodJournalTable;
        ProdJournalBOM      prodJournalBOM;
        ProdTable           prodTable = prodTable::find("POnumber");
    
        prodJournalTable.clear();
        prodJournalTable.initValue();
        prodJournalTable.JournalType    = ProdJournalType::Picklist;
        prodJournalTable.JournalNameId  = "nameid";
        prodJournalTable.Description    = "Description";
        prodJournalTable.ProdId         = prodTable.ProdId;
        prodJournalTable.VoucherDraw    = JournalVoucherDraw::Post;
        prodJournalTable.VoucherSeqRecId = NumberSequenceTable::find(ProdParameters::numRefProdJournalVoucherId().NumberSequenceId).RecId;
        prodJournalTable.insert();
    
        prodJournalBOM.clear();
        prodJournalBOM.initValue();
        prodJournalBOM.JournalId        = prodJournalTable.JournalId;
        prodJournalBOM.initFromInventTable(InventTable::find("..."));
        prodJournalBom.ProdId           = prodTable.ProdId;
        prodJournalBom.LineNum          = 1;
        prodJournalBom.InventDimId      = "...";
        prodJournalBom.TransDate        = systemDateGet();
        prodJournalBom.BOMUnitId        = "Pcs";
        prodJournalBom.BOMConsump       = 1;
        prodJournalBom.InventConsump    = 1;
        prodJournalBom.insert();
        ttsBegin;
        prodJournalTable.selectForUpdate(true);
        prodJournalTable.NumOfLines = 1;
        prodJournalTable.update();
        ttsCommit;
        info(strFmt("Journal %1 created",prodJournalTable.JournalId));
    }
    

    You could check the standard code in the createProdPickingListJournal method in the WHSProductionScrapHistory table.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans