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

Extension Question

(0) ShareShare
ReportReport
Posted on by 45

Hi All,

I am trying to create a relationship between Sales Quotes and Simulated Production Orders.

I wrote a very simple extension which adds a new field to the Sim Prod. Order to store the quotation number reference and also created a new action on the Sales Quote page for the creation of a new Simulated Production Order.

Using the following it successfully creates a new Sim Prod Order

action("CreateNew")
            {
                CaptionML = ENU = '+ New Sim Order';
                Image = Production;
                ApplicationArea = All;
                RunObject = page "Simulated Production Order";
                RunPageMode = Create;               
            }
My question is... How do I get send the Quotation number to the Sim Prod Order at time of asking it to create a new one?
I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    150 on at

    You will need to pass a parameter to a function. So from the quote you pass the current record as a variable to a function which creates the simulated production order. It will require code based actions instead of the property based version you have. This pattern exists across the system. Take a look at this simple one:

    action("Archive Document")

                   {

                       ApplicationArea = Suite;

                       Caption = 'Archi&ve Document';

                       Image = Archive;

                       trigger OnAction()

                       begin

                           ArchiveManagement.ArchiveSalesDocument(Rec);

    CurrPage.Update(false);

                       end;

                   }

    You could do this with a report or codeunit. The report version would be like where you print a sales quote and you pass (in code) the quote no.

  • Azzure-IT-CSwann Profile Picture
    45 on at

    Hi Josh,

    Thank you so much for taking the time to help me. Much appreciated.

    My programming experience is in C# for winforms, xamarin mobile and Unity and there is so little training resource regarding the correct syntax for AL and code units etc. There are a lot of snippets but I cant find anything to help me understand this better. But that's another problem... Thank you again for helping me here.

  • Azzure-IT-CSwann Profile Picture
    45 on at

    Just in case anyone else has a similar request. This is how I solved my question, with the help of Josh.

    Create a codeunit to handle the creation of a new record:

    ...

    codeunit 50100 "NewSPO"

    {

       procedure Foo(rec: Record "Sales Header")

       var

           Prod: Record "Production Order";

       begin

           Prod.Init();

           Prod."Quote No." := rec."No.";

           prod.Status := "Production Order Status"::Simulated;

           Prod.Insert(true);

           Page.Run(Page::"Simulated Production Order", Prod);

       end;

    }

    On the page, create an action that invokes the codeunit and passes the Record with it:

    ...

    action("CreateNewSPO")

               {

                   CaptionML = ENU = '+ New Sim Order';

                   Image = Production;

                   ApplicationArea = All;

                   trigger OnAction()

                   var

                       cu: Codeunit "NewSPO";

                   begin

                       cu.Foo(Rec);

                   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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,091 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,032 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 946 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans