Showing results for 
Search instead for 
Did you mean: 

Dependant pcf sub grid control refresh

Can we execute a java script ( from with in a pcf sub-grid control or from outside.

I have a scenario where I have 2 PCF Subgrids when  a record is added to one I want to update the other pcf subgrid

Impactful Individual
Impactful Individual

PCF controls do not have direct access to the client script libraries, but you can still accomplish your objective, just indirectly.


PCF #1 is a dataset control, but you can still bind it to fields as output values. Pick a field on your form (or make a new one for the purpose) that PCF #1 can write a value to in order to announce success. Then set that same field as the bound input for PCF #2 (that is, make PCF 2 a Field type control, not a dataset control) When the field gets updated, PCF2's updateView will get called, and you will know to fire a RetrieveMultiple to update your 'grid'

Super User
Super User

Hi @RishiBhutani , 


My first thought was to try some form scripting, use some grid events to attach to selection on the first and refresh the second dataset using the sdk for the GridControl. Unfortunately I didn't had the time to try it out (I guess the problem is to detect if a record was added).


Second thought would be to use standard JS (window.postMessage) like in my older blog ( but this requires that both PCFs are self made and I'm not so sure if it's supported (I consider it a gray zone). The idea would be that the first PCF knows about adding the record, sends a message, and the secons PCF listens to the message and triggers a refresh its the own dataset.


@cchannon : the idea with an output parameter is interesting. According to the docs, the parameters are only of usage input or bound: I've seen the output parameters only on CanvasApps. Have you tried out the output parameter in model-driven apps? 
In case the output parameters are working, then I would go with your idea regarding the PCF#1, but I wouldn't change the second PCF to a field type PCF (since we loose quite a few functionality provided by the framework). Instead I would use form scripting, register it to "onChange" of the output parameter of the PCF#1, and use form scripting to refresh the second PCF ( as @RishiBhutani mentioned) .


Hope this helps!


Kind regards,


TBH @DianaBirkelbach, you've got me there, and I will be doing some testing on my own to check. It is entirely possible I have never actually used a non-bound output param other than in the context of a canvas app. I will let you know what I find.

Also, I completely agree with your tweak at the end there. Using a formscript event to refresh the grid is an objectively better way to trigger the dataset PCF as opposed to rewriting it as a field PCF. Nice call!

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,495)