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...
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
    61,005 Super User 2025 Season 2 on at

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

  • KasparsSemjonovs Profile Picture
    4,774 Super User 2025 Season 2 on at

    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.

  • Hamish Duff Profile Picture
    37 on at

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

  • Hamish Duff Profile Picture
    37 on at

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

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    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;

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 2,664

#2
YUN ZHU Profile Picture

YUN ZHU 960 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans