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 pass main page Document No into a FactBox

(2) ShareShare
ReportReport
Posted on by 40
I'm developing a plugin that adds a factbox to the Purchase Invoice page. In this factbox, I want to request external REST AI and render some returned data.
 
1) How to pass the main page Document No. (Purchase Invoice number) into the factbox?  
2) Can data be rendered from an external API without creating an intermediate table? Currently, I query an external API and put everything into the "External API Data" table to render it in a factbox. But I want to get rid of this table and display data directly from an external API.
 
My FactBox:
page 50105 "LL Attachment List Factbox"
{
    Caption = 'Documents';
    PageType = ListPart;
    DeleteAllowed = false;
    DelayedInsert = true;
    InsertAllowed = false;
    SourceTable = "External API Data";

    layout
    {
        area(content)
        {
            repeater(Group)
            {
                field(Id; Rec."Number")
                {
                    Caption = 'Number';
                    ApplicationArea = Basic, Suite;
                    ToolTip = 'Specifies the number of the attached file.';
                    Width = 30;

                    trigger OnDrillDown()
                    begin
                        Hyperlink(Rec."Url");
                    end;
                }
            }
        }
    }


    actions
    {
        area(Processing)
        {
            action(RefreshFromAPI)
            {
                ApplicationArea = All;
                Caption = 'Refresh Data';
                Image = RefreshLines;
                Promoted = true;
                PromotedCategory = Process;
                PromotedIsBig = true;
                ToolTip = 'Refresh data from the external API.';

                trigger OnAction()
                var
                    APIHelper: Codeunit "Handler";
                begin
                    // TODO: Pass actual Purchase Invoice number here
                    APIHelper.FetchAPIData('IR-PINV0000001951');
                    CurrPage.Update(false);
                end;
            }
        }
    }
}
 
I have the same question (0)
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,529 Super User 2025 Season 2 on at
    To pass the Document No. (Purchase Invoice number) from the main page to your FactBox, you can utilize the SubPageLink property.
     
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
     
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,971 Super User 2025 Season 2 on at
     layout
        {
            area(factboxes)
            {
                part(Attachments; "LL Attachment List Factbox")
                {
                    SubPageLink = "Document No." = FIELD("No."); // optional if binding record
                }
            }
        }
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,971 Super User 2025 Season 2 on at
    You can pass the Purchase Invoice number to the FactBox by creating a SetDocumentNo procedure in the FactBox and calling it from the main page. For API data, you can use a temporary record in the FactBox, fetch the data in OnOpenPage and directly display the API response.

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 2,116

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 764 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 635 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans