web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Answered

PCF Refresh Form

(0) ShareShare
ReportReport
Posted on by 136

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?

I have the same question (0)
  • a33ik Profile Picture
    3,306 Most Valuable Professional on at

    @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.

  • ScottDurow Profile Picture
    1,039 on at

    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! 😂

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

     


    @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? 

  • Ndewitt Profile Picture
    136 on at

    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!

  • AKhaing Profile Picture
    45 on at

    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?

  • ScottDurow Profile Picture
    1,039 on at
    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.
  • Hemant Gaur Profile Picture
    on at

    @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. 

  • Verified answer
    Hemant Gaur Profile Picture
    on at

    @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 

  • RishiBhutani Profile Picture
    Microsoft Employee on at
    @HemantG @cakhaing - Real time update of control on form doesn't happen from PCF.
     
    Is there something I'm missing. Even though I have updated the control value the onchange is not firing.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard