web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to update factbox using code in bc15

(0) ShareShare
ReportReport
Posted on by 40

Hi,

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

The page code looks like below

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.
I have the same question (0)
  • Suggested answer
    Andy Sather Profile Picture
    on at

    Hello Nancy - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans