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

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

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