Announcements
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?
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 :)
}
}
}
}
######
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.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156