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

How to show only posted sales order in my Sales archive field

(0) ShareShare
ReportReport
Posted on by 208

Here I have field sales order archive where I have used table relation for getting orders, but I wanted to only show the posted sales order details in my field how can be done?

page 50418 EnquiryFilter

{

    Caption = 'EnquiryFilter';

    PageType = XmlPort;

    UsageCategory = Administration;

    ApplicationArea = all;

    layout

    {

        area(content)

        {

            group(General)

            {

                field(SalesNo; SalesNo)

                {

                    ApplicationArea = All;

                    TableRelation = "Sales Header"."No.";

                    Caption = 'Sales Order No.';

                    Editable = true;

                    trigger OnValidate()

                    begin

                        if (Rec.ExternalDocNo <> '') Or (Rec.shipToCode <> '') or (Rec.BillPostCode <> '') or (Rec.SalesOrderNo <> '') then begin

                            Rec.SalesOrderNo := SalesNo;

                            Rec.Modify();

                        end

                        else begin

                            Rec.Init();

                            Rec.No := CreateGuid();

                            Rec.SalesOrderNo := SalesNo;

                            Rec.Insert();

                        end;

                    end;

                }

                field(SalesArchiveNo; SalesArchiveNo)

                {

                    ApplicationArea = All;

                    TableRelation = "Sales Header Archive"."No.";

                    Caption = 'Sales Archive Order No.';

                    Editable = true;

                    trigger OnValidate()

                    begin

                        if ((Rec.ExternalDocNo <> '') Or (Rec.shipToCode <> '') or (Rec.BillPostCode <> '') or (Rec.SalesOrderArchive <> '')) and (Rec.SalesOrderNo = '') then begin

                            Rec.SalesOrderArchive := SalesArchiveNo;

                            Rec.Modify();

                        end

                        else begin

                            Rec.Init();

                            Rec.No := CreateGuid();

                            Rec.SalesOrderArchive := SalesArchiveNo;

                            Rec.Insert();

                        end;

                    end;

                }

            }

        }

    }

    var

        SalesNo: Code[20];

        SalesArchiveNo: Code[20];

        ExternalDOCNo: Code[35];

        PostCode: Code[50];

        shipToCode: Code[50]

;

        Archive: Boolean;

        Rec: Record EnquiryFilter;

}

I have the same question (0)
  • Suggested answer
    GER_Nico Profile Picture
    117 on at

    The posted invoices are stored in the "Sales Invoice Header" table. So use this table in the TableRelation instead of the "Sales Header" table.

    As far as I know, there are no archived posted invoices.

  • Dividutt Profile Picture
    208 on at

    Yes I can but, can I filter Sales header archive table by showing only posted sales order in my field.

    As I code according to sales archive order so?

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    For Posted Archives records you can use below fields from Sales header Archive table.

  • Dividutt Profile Picture
    208 on at

    Hi where to use this field in my code , ,where I used sales archive field?

    Little confused on how to use it?

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    you can use this field when look up archive table

  • Dividutt Profile Picture
    208 on at

    Sorry, I am getting Boolean error.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,002 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,255 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,217

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans