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;
}