Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
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?

  • RishiBhutani Profile Picture
    Microsoft Employee on at
    Re: PCF Refresh Form
    @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.
  • Verified answer
    Hemant Gaur Profile Picture
    on at
    Re: PCF Refresh Form

    @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 

  • Hemant Gaur Profile Picture
    on at
    Re: PCF Refresh Form

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

  • ScottDurow Profile Picture
    1,039 on at
    Re: PCF Refresh Form
    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.
  • AKhaing Profile Picture
    45 on at
    Re: PCF Refresh Form

    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?

  • Ndewitt Profile Picture
    136 on at
    Re: PCF Refresh Form

    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!

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: PCF Refresh Form

     


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

  • ScottDurow Profile Picture
    1,039 on at
    Re: PCF Refresh Form

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

  • a33ik Profile Picture
    3,304 Most Valuable Professional on at
    Re: PCF Refresh Form

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

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 65 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 55 Super User 2025 Season 1

Overall leaderboard