web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Printing the Job Card Automatically by Refreshing the Production Order

(3) ShareShare
ReportReport
Posted on by 3,214
Hi:
 
In Business Central, is there a way to have the Job Card report print to PDF upon clicking the "Refresh Production Order" button?
 
Thanks!
 
John
I have the same question (0)
  • Verified answer
    Sohail Ahmed Profile Picture
    11,148 Super User 2025 Season 2 on at

    Hi! 👋

     

    Out of the box, Business Central doesn't print the Job Card automatically when you hit "Refresh Production Order" — it's just a planning function. However, this can be achieved with a small customization.

     

    Here's how:

     

    Use an event subscriber on the OnAfterRefreshProdOrder event in the "Planning Routing Line" Codeunit (5407) (or appropriate Prod. Order handling codeunit).

    ✅ In the subscriber, call the Job Card report using Report.RunRequestPage or Report.SaveAsPdf to auto-generate the PDF.

     

    💡 You can set it up to either:

     
    • Save to a defined folder
    • Auto-download to user
    • Or email using the email scenarios
     

    📌 This will require custom AL code, so you may want to consult with your Microsoft partner or developer.

     

     

    If you’re exploring customizations around this or similar features, feel free to check out my LinkedIn profile — I often share insights and updates there that might help.
     

    Mark below checkbox to make this answer Verified if it helps you. ✅

  • Suggested answer
    RockwithNav Profile Picture
    8,625 Super User 2025 Season 2 on at
    Not in standard and can be achieved with the way mentioned but why you want to automate this?
  • JE-20081519-0 Profile Picture
    3,214 on at
    I'm not getting the PDF file despite my success with the code pasted below.
     
    How do I get the PDF?  It's not even going to my Downloads folder or anywhere else.
     
    pageextension 50101 "ProdOrderExt" extends "Released Production Order"
    {
        actions
        {
            addlast(Processing)
            {
                action(PrintJobCard)
                {
                    Caption = 'Print Job Card';
                    Image = Print;
                    trigger OnAction()
                    var
                        ProdOrderRec: Record "Production Order";
                        JobCardReport: Report "Prod. Order - Job Card";
                        OutputFile: File;
                        OutputFilePath: Text;
                        TempBlob: Codeunit "Temp Blob";
                        OutStream: OutStream;
                    begin
                        // Call original behavior
                        CurrPage.Update(); // Simulate Refresh action or use page action if needed
     
                        // Get the current Production Order
                        Rec.TestField("No.");
                        ProdOrderRec.Get(Rec."No.");
     
                        // Prepare to save report to PDF
                        TempBlob.CreateOutStream(OutStream);
                        // Use a filter string as the second argument
                        Report.SaveAs(Report::"Prod. Order - Job Card", 'No.=' + Rec."No.", ReportFormat::Pdf, OutStream);
     
                        // Save to file system or stream to download — for now, simulate download
                        OutputFilePath := 'JobCard_' + Rec."No." + '.pdf';
     
                        // Create an InStream from the TempBlob and download the file
                        TempBlob.CreateInStream(InStr);
                        DownloadFromStream(InStr, 'Job Card', 'PDF Files|*.pdf', '', OutputFilePath);
                    end;
                }
            }
        }
        var
            InStr: InStream;
    }
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,527 Super User 2025 Season 2 on at
    John - I think the best would be have action button on the Print button Production order page where user can select multiple lines and release and print it.
     

    Implement AL Code to Handle the Process:

    Within your extension, write AL code that performs the following steps:
    • Call the standard RefreshProductionOrder function to update the production order.
    • Invoke the Job Card report (Report ID: 99000762) using the Report.Run or Report.SaveAsPdf methods.
    • Specify the output format as PDF and define the save location or handling mechanism.
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
     
  • Suggested answer
    YUN ZHU Profile Picture
    95,593 Super User 2025 Season 2 on at
    Related to the following question:
     
     
    Thanks.
    ZHU

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans