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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PCF control initialize...
Power Apps
Answered

PCF control initializes before full form load and doesn't trigger updateView

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all

 

We've already a ticket open at microsoft and I'm now curious if any of you ever faced this issue.

 

We developed a pcf control with react which formats and validates phone numbers bound to standard phone fields. Only on the production environment (fastest environment, approx. 2k users daily) we have the issue that in some cases the pcf control doesn't receive any props (phone number and iso code for formatting) when the form has fully loaded. UpdateView just doesn't get called anymore and due to a mistake in react pattern phone numbers got overwritten with null. We fixed this:

 

private _numberChanged(newNumber: string) {
 if (newNumber !== this._properties.initialNumber) {
 this._value = newNumber;
 this._notifyOutputChanged();
 }
 }

 

but now the users cannot tell if this record has a phone number or not, possibly generating overhead when they realize the phone number is missing and have to look it up. The pcf control follows best practice, there are no known anti-patterns used. 

 

So to us this seems to be a platform/framework issue due to some strange race conditions as it only happens on the fastes environment. We could never reproduce the issue on any other environment or customer.

 

Any ideas? Any hints?

 

Thanks in advance!

I have the same question (0)
  • cchannon Profile Picture
    4,702 Moderator on at

    I've never seen that happen in a PCF, but if your problem is simply that updateView isn't getting called for some reason, you could just add a bit of formscript that runs onload and calls fireOnChange. That ought to force updateView to fire.

  • Hemant Gaur Profile Picture
    Microsoft Employee on at

    Please DM me the ticket number and share the control . This seems like a bug . 

     

     

    hemant 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi cchannon, this would be considered a workaround and doesn't work either. AddOnChange is not called when form initializes.

  • rbuljevic Profile Picture
    4 on at

    Did you get some meaningful reply?

    This really is an issue as you cannot distinguish between 2 very different cases:

    • a bound field is not yet loaded on the form and therefore null
    • a bound field is loaded but is empty and therefore null

    With PCF updateview you cannot distinguish between those two and that can be a huge issue in practice

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    We do not encounter this issue anymore. It occured only on one environment which is also the production and most fastest. Microsoft never acknowledged this bug and the issue "resolved itself" for us. You can contact microsoft support though but be aware, you need to reproduce the issue everytime otherwise Microsoft will let you wait.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I am still seeing this exact same issue - lookup fields are sometimes having a null value during first one to two updateView calls and then finally get the value on the final updateView.

    There is an undocumented property on the lookup called `isPropertyLoaded` that was working for a while as an indicator that the field had loaded but it is no longer working reliably since the last platform update.
    Are there any plans to provide a supported method/property for determining when we can confidently retrieve the value of the lookup field and know that null is because it has no value and not because it has not loaded?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yeah lookup fields does have that issue, both 'isPropertyLoaded' or 'loading' are not reliable.

    The best way to handle it is to left them to react to decide, in a short time react will receive two times of value, finally it will show with the value.

    But in some cases, the null value means something and we cannot afford to render with null first.

    Finally we abandoned lookup field in PCF for this case, use a XHR request to fetch it's value instead.

  • Beyro Profile Picture
    32 on at

    The approach I am using right now is to hide the lookup field on the form by default, and then use JavaScript to show the field in the form's onLoad event. If you do that, then the field will have the correct value every time.

  • Doetz Profile Picture
    2 on at

    Hello,

    we are also facing the same issue but it is not on Lookup-fields. We have the problem on SingleLine.Text fields. In DEV environment everything was working fine but in the other environments this problem occured. The PCF component is having null values on init. We are using React and Fluent UI to render the PCF. Additionally we check the field attributes if the field is required and based on that set error messages for required fields using Formcontext (window.getcurrentxrm) and not only "pcf-context".

     

    We tried many things to resolve the problem:

    - Tried to put a delay in init using settimeout method, but this broke the pcf component because it was not loading properly

    - Tried to retrieve data with an api call but this seems not to be a good approach

    - I'm executing the same methods and steps in init() and in updateview() but this does also not work for us.

     

    @Beyro 's suggestion to use JavaScript and show the field afterwards might be a usefull approach, didnt try it till yet.

     

    Has anyone else any suggestions which could help?

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

    Hi @Doetz , 

    it is the expected behaviour that the values are not there during the init.
    Sometimes they are not there not even for the first call in updateView, but at least the last call in updateView will have the right value.

    Also, inside a PCF it's not supported to work with the Xrm.* object. That's stated in the sdk: https://docs.microsoft.com/en-us/power-apps/developer/component-framework/reference/?WT.mc_id=BA-MVP-5004107

    The best practice is to use the form scripting OnLoad and OnChange events, and check there the value, and set there the field notification: https://docs.microsoft.com/en-us/power-apps/developer/component-framework/code-components-best-practices?WT.mc_id=BA-MVP-5004107#do-not-interact-directly-with-formcontext

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 273

#3
Kalathiya Profile Picture

Kalathiya 232 Super User 2026 Season 1

Last 30 days Overall leaderboard