Register a Function OnLoad of a SubGrid in Dynamics 365 Power Apps

Leave a comment

In this post, we will show how to register a function that runs on the loading of a subgrid in Dynamics 365.

Consider the Contacts subgrid, of which the control is called “Contacts”:

We can write code to get the control below using the formContext:

var subgrid = formContext.getControl(“Contacts”);

Now, in order to add a function, we use the addOnLoad method. Let’s add a function on the fly here:

subgrid.addOnLoad(function() { console.log(“Grid onload function has run”); });

Now, when we refresh the subgrid, the function will run:

subgrid.refresh();

We see:

Grid onload function has run

 

Carl de Souza
Keep learning. Keep building.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.

Subscribe on YouTube →
Carl de Souza Enterprise Architect at Microsoft · AI Technology Expert

Leave a Reply

Your email address will not be published. Required fields are marked *