Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Creating a Factbox that sits on multiple card and list pages with different source tables

Posted on by 350

i want to create a factboy that sits on basically every page that has a sourcetable with the field SystemCreatedBy.

It should display always this information.


i would like to avoid redundancy. therefore i am looking into defining the factbox only once.

As i learned, it is inserted via a pageextension of the parent page. is there another way, maybe? maybe through a codeunii?
Also, i would have to figure out a flexible way to address the (then changing) SourceTable.

Any ideas on how to aproach this?

  • benovic Profile Picture
    benovic 350 on at
    RE: Creating a Factbox that sits on multiple card and list pages with different source tables

    Thanks for the explanation, Inge!

    I learned that i have to do a pageextension for every page i want to include the FactBox.

    I understand your concerns, but want to look into this because i would like to keep the code redundancy reasonably minimal. (is it?)

    As a codeunit, I would have to look into that - did notthink of this before, thanks!

    As a practical example, I want to display a Factbox the shows the User who created the Document/Record, so i look for the field  SystemCreatedBy

    OmniBox.al:

    ######

    page 55555 OmniFactbox

    {

        Caption = 'OmniFactbox';
        PageType = CardPart;
        SourceTable = Item; // this should be dynamic

        layout
        {
            area(Content)
            {
                field(SystemCreatedBy; GetFullName(Rec.SystemCreatedBy))
                {
                    ApplicationArea = All;
                    Caption = 'Created by: ';
                    Lookup = true;
                    ToolTip = 'Created by: User Name';
               }
            }
        }

        procedure GetFullName(userID: Guid): Text
        var
            UserInfo: Record User;
        begin
            if UserInfo.Get(userID) then begin
                exit(UserInfo."Full Name");
            end
            else begin
                exit('');
            end;
        end;

    }

    ######



    itemListPageExt.al
    ######
    pageextension 55554 ItemsPageExt extends "Item List"
    {
        layout
        {
            addafter(Description)
            {
                field("Safety Lead Time"; Rec."Safety Lead Time")
                {
                    ApplicationArea = All;
                }
            }
            addfirst(factboxes)
            {
                part(FactBox55555; OmniFactbox)
                {
                    ApplicationArea = All;
                    SubPageLink = ??? // also to do :)
                }
            }
        }
    }
    ######
     
  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,744 Moderator on at
    RE: Creating a Factbox that sits on multiple card and list pages with different source tables

    I would recommend you do not implement this.

    The information you are looking for is always available through pace inspection CTRL+ALT+F1

    And if there are a couple of pages where you want it displayed in the page you can do that with a page extension.

    Avoid making this a global thing because you will have to maintain it as pages are changed and added.

    In my experience this is a typical request that comes from user that are not very familiar with the system and as they grown more experience in using the system they no longer see the need for it.

    Using a fact box you would have to have one factbox for every table in you want to display the data for.

    Using a codeunit you could do some fancy stuff with recordrefs - but you will still have to add an action to every page.

    Page inspection is there always by default out of the box.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,570 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,683 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans