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 24
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;
            }
        }
    }
}
 
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    14,928 Super User 2025 Season 1 on at
    How to pass main page Document No into a FactBox
    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.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    14,928 Super User 2025 Season 1 on at
    How to pass main page Document No into a FactBox
     layout
        {
            area(factboxes)
            {
                part(Attachments; "LL Attachment List Factbox")
                {
                    SubPageLink = "Document No." = FIELD("No."); // optional if binding record
                }
            }
        }
  • Suggested answer
    Ramesh Kumar Profile Picture
    3,501 on at
    How to pass main page Document No into a FactBox
    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.
     
     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,017 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans