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

Announcements

No record found.

News and Announcements icon
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

  • Suggested answer
    Mohana Yadav Profile Picture
    61,250 Super User 2026 Season 2 on at

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

  • KasparsSemjonovs Profile Picture
    4,851 Super User 2026 Season 1 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,250 Super User 2026 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 765 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 571 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 299 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans