web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 2,510
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)
  • Suggested answer
    YUN ZHU Profile Picture
    90,070 Super User 2025 Season 2 on at
    Printing the Job Card Automatically by Refreshing the Production Order
    Related to the following question:
     
     
    Thanks.
    ZHU
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,503 Super User 2025 Season 2 on at
    Printing the Job Card Automatically by Refreshing the Production Order
    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.
     
  • JE-20081519-0 Profile Picture
    2,510 on at
    Printing the Job Card Automatically by Refreshing the Production Order
    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
    RockwithNav Profile Picture
    7,980 Super User 2025 Season 2 on at
    Printing the Job Card Automatically by Refreshing the Production Order
    Not in standard and can be achieved with the way mentioned but why you want to automate this?
  • Verified answer
    Sohail Ahmed Profile Picture
    10,983 Super User 2025 Season 2 on at
    Printing the Job Card Automatically by Refreshing the Production Order

    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. ✅

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,678 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,635

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,210

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans