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

Solution Supplier
Solution Supplier

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Users online (81,583)