is there an option to refresh a subgrid control from a powerapps control?
We currently have a setup with 1 subgrid, 1 custom grid. The custom grid creates rows in the subgrid but changes aren't reflected immediately, a manual refresh has to be triggered.
Can we call the subgrid resfresh somehow?
A PCF component lives in it's own self contained world it doesn't have the ability to talk to or control the other controls on a form.
If your custom grid PowerApps control is a field control you could update a bound return value and write a script at the form level to trigger the subgrid refresh as you refresh the bound value.
If you PowerApps control is a DataSet control, sadly, I can't think of any way to tell the page that the datagrid needs to be updated.
but for calling the refresh of the subgrid I need to be able to get the control from the formcontext. However, I cannot seem to find the formcontext in the context (found several contexts in the unexposed API but formcontext is not one of them).
I completely get that the idea behind having these things encapsulated so that they work between Canvas an Modal but I think PCF should be used for more than just the situation where you will use it for both. Many times I work on project where we just have Model apps and may never create a Canvas app. I certainly would love to have access to the formContext in these cases.
As an answer to your question on how to get the grid to refresh you have two option.
You can utilize the deprecated Xrm namespace within your control. Again this is deprecated so who knows when Microsoft will say goodbye to it.
Or if you did want to make it a bit more supported you could
Check out these cool Power Apps & vote on your favorite!
Check out whats happening in Power Apps
FIll out a quick form to claim your community user group member badge today!
Features releasing from October 2020 through March 2021