Is there any way to refresh the current page, if for example I have made updates to something via the webAPI?
I suppose I could context.navigation.openForm({ }) the current record, but that seems a bit hacky, is there any supported way to refresh the current page?
@ScottDurow wrote:
This approach - whilst would work introduces some negative coupling between form JavaScript and the PCF component. A maker wouldn’t be able to just add a control to their form - they would also need to write JavaScript and know how the control works.
Ack the pain point here , we are working on the plan to address it more graceful and generic manner. We will make details available when ready.
thanks,
Hemant
@cakhaing wrote:
When PCF supports binding of complex data types, we probably don't need to 'Refresh' the form inside PCF.
Ideally, a PCF component should update attributes of the host record via bound properties, instead of updating via WebAPI.
If you really need it, I would suggest to refresh the form outside PCF. For example,
1. Bind PCF to an attribute (could be a dummy attribute)
2. Update a record via WebAPI just like you are doing right now
3. Update the value of the bound property in PCF (that will trigger onChange event of the attribute)
4. On the Form customisation, add onChange event on the attribute and write JavaScript to execte formContext.data.refresh
@NickDewitt I've used above approach to refresh the subgrid and works well.
@HemantG Will we be able to bind these complex data types (https://docs.microsoft.com/en-us/powerapps/developer/component-framework/manifest-schema-reference/property#value-elements-that-are-not-supported) in PCF in the near future?
That is the best supported way to do it, thanks. We are reviewing the complex data types - Lookup.Simple is the one which is priority for next semester. Other will be added in future releases.
When PCF supports binding of complex data types, we probably don't need to 'Refresh' the form inside PCF.
Ideally, a PCF component should update attributes of the host record via bound properties, instead of updating via WebAPI.
If you really need it, I would suggest to refresh the form outside PCF. For example,
1. Bind PCF to an attribute (could be a dummy attribute)
2. Update a record via WebAPI just like you are doing right now
3. Update the value of the bound property in PCF (that will trigger onChange event of the attribute)
4. On the Form customisation, add onChange event on the attribute and write JavaScript to execte formContext.data.refresh
@NickDewitt I've used above approach to refresh the subgrid and works well.
@HemantG Will we be able to bind these complex data types (https://docs.microsoft.com/en-us/powerapps/developer/component-framework/manifest-schema-reference/property#value-elements-that-are-not-supported) in PCF in the near future?
Thanks for the feedback everyone, in the end I just ended up displaying the data that I needed to update inside the control so that I didn't need to refresh the form at all.
On a side note, context.navigation.openForm({ }) actually wasn't too bad, although it did refresh the whole form with a little flicker, it didn't refresh the ribbon or side menu, so while not as nice as the formContext.data.refresh(), it was better than nothing.
I would still like to know the answer to @ScottDurow's question; Will this eventually be supported in custom PCF components? any chance on a comment @hemant?
On another side note, this is literally the most happy I have ever been while customising Dynamics/Powerapps, so keep up the great work!
@ScottDurow wrote:This is something that the embedded CanvasApp control does when calling ModelDrivenFormIntegration.RefreshForm
Interally inside cc_MscrmControls.Canvas.* it uses:
window.Xrm.Page.data.refresh()@HemantG - will this eventually be supported in custom PCF components? It seems unfair that the first party CC can do it but we can't! 😂
Since Xrm.Page is deprecated, I suppose that won't be the way to do it.
Maybe if the control notifies the form about a change (even if not the current attribute was actually changed)? Maybe that could trigger a data refresh?
This is something that the embedded CanvasApp control does when calling ModelDrivenFormIntegration.RefreshForm
Interally inside cc_MscrmControls.Canvas.* it uses:
window.Xrm.Page.data.refresh()
@HemantG - will this eventually be supported in custom PCF components? It seems unfair that the first party CC can do it but we can't! 😂
@NickDewitt I believe there is no good and supported way of doing it because your control can be located on "Quick Create" or "Quick View" form. Your approach looks a bit hacky but anyway should work.
WarrenBelz
85
Most Valuable Professional
Michael E. Gernaey
65
Super User 2025 Season 1
mmbr1606
55
Super User 2025 Season 1