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...
Suggested answer

Updating reference in PO created from SO

(0) ShareShare
ReportReport
Posted on by 37

Hi folks,

I'm creating purchase orders from sales orders for items not in stock - that is the normal process in this firm as we don't hold stock of most items, and lead times are short.

When I create the Purchase Order, ideally we'd like to automatically update the PO created to include the Sales Order # in the "Your Reference" field.

I'm unsure how to develop an extension to do that - has anyone else done the same, and able to share the best approach?

Cheers,

Hamish

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,949 Super User 2025 Season 2 on at
    RE: Updating reference in PO created from SO

    You can try the following event

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch. Doc. From Sales Doc.", 'OnCreatePurchaseOrderOnAfterPurchaseHeaderSetFilters', '', false, false)]

       local procedure OnCreatePurchaseOrderOnAfterPurchaseHeaderSetFilters(var PurchaseHeader: Record "Purchase Header"; SalesHeader: Record "Sales Header");

       begin

           if PurchaseHeader.FindSet() then

               repeat

                   PurchaseHeader."Your Reference" := SalesHeader."No.";

                   PurchaseHeader.Modify();

               until PurchaseHeader.Next() = 0;

       end;

  • Hamish Duff Profile Picture
    37 on at
    RE: Updating reference in PO created from SO

    Thanks for the pointer. I'm thinking there must be an event firing when you click Create Purchase Orders, I'm hoping I can use that to insert the reference...

  • Hamish Duff Profile Picture
    37 on at
    RE: Updating reference in PO created from SO

    Sure, just the button to create purchase orders under Related, Funtions. Actually I've relocated it to Home for easy access.

  • KasparsSemjonovs Profile Picture
    4,661 Super User 2025 Season 2 on at
    RE: Updating reference in PO created from SO

    In standard it is possible, that You create 1 purchase order that is connected to several Sales Orders, so if You want to do it 1 by 1, don't forget to add a check regarding this.

  • Suggested answer
    Mohana Yadav Profile Picture
    60,949 Super User 2025 Season 2 on at
    RE: Updating reference in PO created from SO

    May I know what action/process are you using to create the PO?

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,132

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 3,615

#3
Sumit Singh Profile Picture

Sumit Singh 2,912

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans