Search code examples
microsoft-dynamicsdynamics-365dynamics-business-centralbusinesscentral

When I select a row in a factbox how can I get the record?


Using a Chronus purchase invoices:

enter image description here

I'm interested in modifying the "Incoming Document Files" textbox.

When I select a file, I want to display it into another factbox, so my first step is trying to read the record that I've selected.

In this case, I've selected the file PLIMON_TSK0007. So if I click on the file PLIMON_TSK0008 it will change and the selected file it will be the PLIMON_TSK0008:

enter image description here

How can I use that event? Or how can I get the record when I select a new row?

I'm trying with this code:

pageextension 51101 "IncomingDoc.Attach.FactBoxExt" extends "Incoming Doc. Attach. FactBox"//193
{
    trigger OnAfterGetRecord()
    begin
    end;

    trigger OnAfterGetCurrRecord()
    begin
    end;
}

But it will break the factbox, when I select a new row it disappears:

enter image description here

That's how it looks when loading that code and selecting TSK0008...


Solution

  • You can link one FactBox to another through the Provider property.

    Consider page A to which we add page B and page C as FactBoxes. We can then link page C to the selected record on page B like this:

    page 50000 A
    {
        ...
        
        layout
        {
            area(Content)
            {
                group(Records)
                {
                    ...
                }
            }
            area(FactBoxes) {
                part(B;B)
                {
                    ...
                }
                part(C;C) {
                    Provider = B;
                    SubPageLink = ...
                }
            }
        }
    }
    

    In your case you would need to add your custom FactBox to the Purchase Invoices page through a pageextension and the set the Provider to the Incoming Document Files FactBox.