I want to update factbox through code from the page. the factbox is not getting updated with filtered values.I'm not sure what is wrong with the below code
page 50010 "ItemLedgerEntrie"
{
CaptionML = ENU = 'Item Ledger Entries',
DEU = 'Artikelposten';
PageType = List;
editable = false;
SourceTable = "Item Ledger Entry";
//PromotedActionCategoriesML = ENU = 'New,Process,Report,Manage,SalesInvoice', DEU = 'Neu,Prozess,Bericht,Verwalten,VK-Rechnung';
layout
{
area(content)
{
repeater(General)
{
field("Document Date"; Rec."Document Date")
{
ToolTip = 'Specifies the value of the Document Date field';
ApplicationArea = All;
}
field("Document No."; Rec."Document No.")
{
ToolTip = 'Specifies the value of the Document No. field';
ApplicationArea = All;
trigger OnDrillDown()
var
SalesShipmentHeader: Record "Sales Shipment Header";
PostedSalesShipment: Page "Posted Sales Shipment";
begin
SalesShipmentHeader.RESET;
SalesShipmentHeader.Get(rec."Document No.");
CLEAR(PostedSalesShipment);
PostedSalesShipment.SETRECORD(SalesShipmentHeader);
PostedSalesShipment.SETTABLEVIEW(SalesShipmentHeader);
PostedSalesShipment.LOOKUPMODE(TRUE);
PostedSalesShipment.EDITABLE(TRUE);
IF PostedSalesShipment.RUNMODAL = ACTION::OK THEN BEGIN
PostedSalesShipment.GETRECORD(SalesShipmentHeader);
END;
end;
}
}
}
area(factboxes)
{
part(PostedsalesInvoiceFB; "PostedsalesInvoiceFB")
{
ApplicationArea = all;
}
}
}
trigger OnAfterGetCurrRecord()
var
TempSalesInvLine: Record "Sales Invoice Line" temporary;
begin
clear(TempSalesInvLine);
GetSalesInvLines(TempSalesInvLine);
IF not TempSalesInvLine.IsEmpty THEN
if TempSalesInvLine.FindFirst() then begin
CurrPage.PostedsalesInvoiceFB.Page.UpdateRecord(TempSalesInvLine);
end;
CurrPage.UPDATE(true);
end;
factbox:
page 50025 "PostedsalesInvoiceFB"
{
Caption = 'Invoiced Items';
PageType = CardPart;
SourceTable = "Sales Invoice Line";
SourceTableTemporary = true;
InsertAllowed = false;
Editable = false;
DeleteAllowed = false;
layout
{
area(content)
{
field("Document No."; "Document No.")
{
ApplicationArea = all;
trigger OnLookup(var myText: Text): boolean
var
SalesInvHeader: Record "Sales Invoice Header";
PostedSalesInv: Page "Posted Sales Invoice";
begin
if SalesInvHeader.get(rec."Document No.") then begin
CLEAR(PostedSalesInv);
PostedSalesInv.SETRECORD(SalesInvHeader);
PostedSalesInv.SETTABLEVIEW(SalesInvHeader);
PostedSalesInv.LOOKUPMODE(TRUE);
PostedSalesInv.EDITABLE(TRUE);
IF PostedSalesInv.RUNMODAL = ACTION::OK THEN BEGIN
PostedSalesInv.GETRECORD(SalesInvHeader);
END;
end
end;
}
field(No; "No.")
{
ApplicationArea = All;
}
field(Description; Description)
{
ApplicationArea = All;
}
field(Amount; Amount)
{
ApplicationArea = All;
}
field("Order No."; "Order No.")
{
ApplicationArea = all;
}
}
}
procedure UpdateRecord(Var TempSalesInvLine: record "Sales Invoice Line" temporary)
var
myInt: Integer;
begin
rec.Reset();
// rec.Delete();
Rec.Copy(TempSalesInvLine, true);
CurrPage.Update();
end;
Thanks in advance.