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 :
Small and medium business | Business Central, N...
Suggested Answer

Automatically assign starting time & post production journal output lines

(8) ShareShare
ReportReport
Posted on by 268
Hello, is there a way to automatically assign the starting time (based on the current time) and automatically post production journal output lines for released production orders?
 
I added a page action to the released production order screen for this with the procedure below:
 
 
For some reason, the system does not find the line in the production journal so lines 96-98 are not executed. I also noticed the starting time does not get saved on the production journal line when we manually enter it. Is there a way to automatically set that to the current time (time when the page action is clicked)?
 
Any guidance on how to develop this will be greatly appreciated. Thank you.
I have the same question (0)
  • Suggested answer
    Dhiren Nagar Profile Picture
    2,876 Super User 2026 Season 1 on at
    Hi,
     
    I think thr Flushing method filter is not needed. Unless your logic wants it.
     
    Also instread of Released Production order, if you create action on Production journal, if ok with your requirement, then you can directly select output entry and use SetSelectionFilter on Rec. That makes it easy. Even on the page if user selevt any other entry you can easily find output entry with Order No. Filter and type filter.
     
    Another thing not suggested to do is hardcode your Template and batch names. Better to take it from setups.
     
    Regards,
    Dhiren.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    21,573 Super User 2026 Season 1 on at
    Your code doesn’t find the line because you’re filtering incorrectly. Production output lines are found by Order No. + Entry Type = Output, not Document No. Ensure the journal lines exist first, then set Starting Time using Validate + Modify(true) and post using Item Jnl.-Post Batch.
    Something like this.
    ItemJnlLine.Reset();
    ItemJnlLine.SetRange("Order Type", ItemJnlLine."Order Type"::Production);
    ItemJnlLine.SetRange("Order No.", Rec."No.");
    ItemJnlLine.SetRange("Entry Type", ItemJnlLine."Entry Type"::Output);
    if ItemJnlLine.FindSet(true) then begin
        repeat
            ItemJnlLine.Validate("Starting Time", DT2Time(CurrentDateTime));
            ItemJnlLine.Modify(true);
        until ItemJnlLine.Next() = 0;
        CODEUNIT.Run(CODEUNIT::"Item Jnl.-Post Batch", ItemJnlLine);
    end;
     
  • Suggested answer
    OussamaSabbouh Profile Picture
    11,500 Super User 2026 Season 1 on at
    Hello,
    This behavior is expected because production journal lines often don’t exist until they’re calculated, and your code filters are too restrictive (wrong/missing journal batch, unreliable Document No., and flushing method), so FindFirst returns nothing; additionally, Starting Time on production/output lines can be overwritten or ignored by posting logic unless set correctly. The working approach is to first ensure the production journal lines are created, then find output lines by Journal Template + Batch + Order No., set Starting Time using VALIDATE with DT2Time(CurrentDateTime()) and Modify(true), and finally post using Item Jnl.-Post Batch, which reliably posts all output lines for the released production order.
    Regards,
    Oussama Sabbouh
  • AK-13051749-0 Profile Picture
    268 on at
    Thank you all for the suggestions.
     
    I updated the code based on the suggestions, but it is still not finding the lines.
     
     
    I didn't use a filter for the journal batch name because that will be different for each user, and this should work for all users.
     
     
    I would just like to post the manual output lines. Could you please provide some more guidance on how to achieve this? Thank you in advance.
  • AK-13051749-0 Profile Picture
    268 on at
    Thank you all for the suggestions.
     
    I updated the code based on the suggestions, but it is still not finding the lines.
     
     
    I didn't use a filter for the journal batch name because that will be different for each user, and this should work for all users.
     
     
    I would just like to post the manual output lines. Could you please provide some more guidance on how to achieve this? Thank you in advance.
  • Suggested answer
    YUN ZHU Profile Picture
    98,337 Super User 2026 Season 1 on at
    I suggest you debug it; I've done a quick check, and your conditions seem fine.
    Is it possible that the validation was reset by the standard code?
     
    Thanks.
    ZHU
  • Suggested answer
    Mohana Yadav Profile Picture
    61,184 Super User 2026 Season 1 on at
    Production Journal lines will not be saved in Item Journal Lines table.
    They will be created while opening the page and deleted after closing the page.
     
    So you have to create Output production lines also before modifying and posting.
     
    Check below function in codeunit 5510
    InsertOutputItemJnlLine
  • Suggested answer
    Dhiren Nagar Profile Picture
    2,876 Super User 2026 Season 1 on at
    Hi,
     
    As suggested earlier in my previous comment create an action on Production journal.
    On Production journal page you can simply use SetSelectionFilter to get the record and post it.
     
     
    Regards,
    Dhiren.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,986 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,071 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 975 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans