Update Factbox when changing record via Next or Previous Button


I’ve created a JavaScript ControlAddin for my Customer Card Page which loads Customer Related data.

The Addin is subscribed to the OnAfterGetRecord which works great when you open the customer card.

Unfortunately, when I hit the NEXT - PREVIOUS button on the page, the data in the FactBox remains linked to the original customer.

If I close the page and open the next customer, the data loads properly. I’ve also tested in the Customer List page and when I change customer the data does not update there either.

If I debug my code, the OnAfterGetRecord fires the first time the addin is loaded but will not fire again when I click to view the next customer.

Any thoughts?



This control is located on the factbox, and linked to the OnAfterRecord of the factbox page, not the Customer Card, correct?

What is the source table of the factbox and its SubPageLink?

Hey Alexander,

My control was added to the FactBoxes area of the Customer Card Page.

    part(WeatherCardPart; WeatherCardPart)
        SubPageLink = "No." = field ("No.");
        Caption = 'Current Weather';


The SubPageLink is pointing to the “No.” of the record (customer record?)

My CardPart that was added to the FactBox has the Customer as it’s source table…

page 50007 WeatherCardPart
    PageType = CardPart;
    SourceTable = Customer;



Hi Alexander or anyone else…

Still looking for an answer to this one. From Alexander’s reply, it looks like I’m doing something wrong.

Control is located in a PageType = CardPart

I have the source table SourceTable = Customer;

The page was added to the Customer Page via a pageExtension where the SubPageLink looks right as it works when I open a customer

SubPageLink = “No.” = field (“No.”);

The issue is capturing the event when I change to another customer via the next button.



Hi Yann,

I asked about the subpage link, because wrong setup of this property could cause an issue like this. But in your case everything looks correct - factbox should raise the OnAfterGetRecord trigger.

Could it have anything to do with this line in the start.js?

Microsoft.Dynamics.NAV.InvokeExtensibilityMethod(“OnAfterGetRecord”, []);

Thanks for your help again Alexander,

I ended up figuring it out… My OnAfterGetRecord was located inside the usercontrol braces (in the layout), I had to add another OnAfterGetRecord to the page itself, sop below the layout.

If I only have 1 in the page, the control does not seam to load when I click on the customer but then it does when I move to the next one.

I’m thinking it might be something to do with the ControlReady event which I’m not using at this time for this control.

It’s working though.