Skip to main content

Notifications

Announcements

No record found.

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 200

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;

}

  • Dividutt Profile Picture
    Dividutt 200 on at
    RE: How to show only posted sales order in my Sales archive field

    Sorry, I am getting Boolean error.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: How to show only posted sales order in my Sales archive field

    Hi,

    you can use this field when look up archive table

  • Dividutt Profile Picture
    Dividutt 200 on at
    RE: How to show only posted sales order in my Sales archive field

    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
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: How to show only posted sales order in my Sales archive field

    Hi,

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

  • Dividutt Profile Picture
    Dividutt 200 on at
    RE: How to show only posted sales order in my Sales archive field

    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
    GER_Nico Profile Picture
    GER_Nico 115 on at
    RE: How to show only posted sales order in my Sales archive field

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans