Skip to main content

Notifications

Dynamic 365 Business Central: Automating the Transition from Purchase Quotes to Orders Using Job Queues

Khushbu Rajvi. Profile Picture Khushbu Rajvi. 8,131 Super User 2025 Season 1

Suppose you have a requirement to automatically transfer all released or open purchase quotes to purchase orders in Business Central, without any human intervention. Here, I will discuss how you can handle this process.

The standard Codeunit 96, 'Purch.-Quote to Order,' is used for this purpose. Typically, if you use this codeunit directly in the job queue to transfer, you may encounter the following error:

Reason: The Job Queue cannot be created on its own without a custom report or Codeunit to call. 

To convert released Purchase Quotes to Purchase Orders using the Job Queue, you must:

First, you need to create a codeunit that contains the logic for converting a Purchase Quote into a Purchase Order. Below is a simplified version of how the codeunit might look:

codeunit 50100 "AutomatedPurchQuoteToOrder"

{

    Subtype = Normal;

    trigger OnRun()

    var

        PurchQuoteToOrder: Codeunit "Purch.-Quote to Order";

        PurchHeader: Record "Purchase Header";

    begin

        // Get all open Purchase Quotes

        PurchHeader.RESET;

        PurchHeader.SETRANGE("Document Type", PurchHeader."Document Type"::Quote);

        PurchHeader.SETRANGE(Status, PurchHeader.Status::Released); // Only Released quotes


        // Loop through each open Purchase Quote and convert it to Order

        if PurchHeader.FINDSET THEN BEGIN

            REPEAT

                // Call the existing "Purch.-Quote to Order" codeunit to make the order

                PurchQuoteToOrder.RUN(PurchHeader);

            UNTIL PurchHeader.NEXT = 0;

        END

    end;

}

After writing the codeunit, publish it to the system. This will make it available for execution.

You can then create a Job Queue entry to run this codeunit at a specific time or interval.


Running the Job Queue: When the Job Queue is triggered, it will automatically run the codeunit, which will process any released purchase quotes and convert them into purchase orders based on the logic defined in your codeunit.

Final Thoughts:

Once this setup is complete, you’ll have a fully automated process that converts release-purchased quotes into purchase orders using Business Central’s Job Queues. The Job Queue will execute the codeunit periodically or on demand, reducing manual intervention.

Feel free to adjust the logic based on your specific requirements, like handling quote line items or additional validations. You can then document the process in your blog post with these steps, along with any adjustments you've made to fit your needs.


Hope this helps...!!


Regards,

Khushbu Rajvi


This was originally posted here.

Comments

*This post is locked for comments