Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Unanswered

For a given Report as Finished journal, get list of serial numbers for the items produced

(1) ShareShare
ReportReport
Posted on by 9
Hello. Is there a way to get a list of items and their corresponding serial numbers when given a journal ID for a report as finished journal? I have a query that works except in the case where there are multiple report as finished journals for a single production order. A use case for multiple journals for a single production order is when all of the items are not produced at once.

Below is sample code (I removed code in order to simply) that uses CoC when a report as finished journal is posted. When this is called for the second journal that is posted for the same production order, the query will return the serial numbers for the first journal that was posted earlier.

If I can't find a query that returns the serial numbers for the given journal, then one solution is to flag the serial numbers that have already been processed and skip those on the future calls.

Thank you for your time.
[ExtensionOf(classStr(ProdJournalCheckPostProd))]
final class ProdJournalCheckPostProd_Extension
{
    void run()
    {
        next run();        

        ProdJournalTable prodJournalTable = journalTableData.journalTable();

        if (prodJournalTable.JournalType != ProdJournalType::ReportFinished)
        {
            return;
        }

        ProdTable prodTable = ProdTable::find(prodJournalTable.ProdId);

        List serialNumbers = new List(Types::String);

        InventTrans inventTrans;
        InventDim inventDim;
        InventTransOrigin inventTransOrigin;
        InventSerial inventSerial;

        while select InventSerialId from inventDim
            join RecId, StatusReceipt from inventTrans
            where inventTrans.inventDimId == inventDim.inventDimId
            join ItemId from inventTransOrigin
            where inventTransOrigin.RecId == inventTrans.InventTransOrigin
            && inventTransOrigin.InventTransId == prodTable.InventTransId
        {
            serialNumbers.AddEnd(inventDim.InventSerialId);
        }
     }
}
 
  • André Arnaud de Calavon Profile Picture
    295,779 Super User 2025 Season 1 on at
    For a given Report as Finished journal, get list of serial numbers for the items produced
    Hi jgoyne,
     
    Do you need only the serial per journal or all serials from all report as finished journals? In case of multiple journals does it have only the serials from the first journal or all posted journals? 
    In your select statement, you are not restricting the inventTransOrigin to use transactions from a specific production journal  (prodJournalTable record)

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 171 Super User 2025 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 140 Super User 2025 Season 1

#3
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 127 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans