Thinking about FactBoxes

Today, I was working on a new E Foqus product and this is something that needs a fair amount of FactBoxes.

It could be solved using a single FactBox object throughout the system. I started with a C/Side approach, trying to get the information from the parent page into the FactBox with SubPageLink but that didn’t work. I was even trying to be too creative with the new SystemId field.

Then it hit me, my C/Side mindset was actually limiting me, I didn’t need to constrain myself with Extension V1 limitations for page changes, I could do anything I wanted, as long as I stayed within the pageextension capabilities.

So the FactBox is added, no SubPageLink or anything. But I added a Fill public function to the FactBox page and called that function in OnAfterGetCurrRecord. The Fill function takes a RecordRef from Rec and the FactBox figures out what show from that.

(The “Hougaard” bits are just obfuscation because this is an unannounced product)

The Table Mapping stuff is a global control to only show the FactBox on Card pages where I have data to show.

So the only thing left to do is creating a batch of copies of the pageextension, only changing the first line (to extend different card pages).

In many ways, a very simple and obvious solution, but I thought it was interesting to blog about the process of getting to the simple solution.

Moral of the story, don’t let your wast experience with C/Side limit the way you design solutions in AL.