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 - I cannot get the...
Power Apps
Unanswered

PCF - I cannot get the field value on load.

(0) ShareShare
ReportReport
Posted on by 4

Hello,

 

Since a while, I started to create my own PowerApps Components.

Recently, I created a component that answers the need of formatting phone numbers for one of my clients. My component contains two parts, a select element that allows to select a phone code and a text field that contains the actual phone number. The output result is the addition of the phone code and the phone number (the output of the screen below is +49123456789)

 

AnthonyFerry_7-1635164275165.png

 

 

The component works perfectly inside the PCF test environment.

I imported on the client development environment, no problems.

Since the component is installed in production environment, once in five, the component doesn't load the CRM field value. If I look at the context in the init() or updateView() functions, there is no traces of a value. I have to refresh the page for the component to load the value.

 

AnthonyFerry_8-1635164300749.png

In the screen above, I get the context : 

 

this._context = context;

 

 

Then I call the function : this.initializePhoneNumber();

AnthonyFerry_9-1635164332447.png

Into the initialization function, the code below returns null once in five.

 

this._context.parameters.phoneNumberValue.formatted;

 

Here is how I declare the property in the manifest file: 

AnthonyFerry_10-1635164466916.png

 

Have you ever seen this kind of issues ? Is it possible that the huge amount of data in the production environment takes to much time to load, which cause the component to load before it can access that data ? 

 

Thank you for considering this question.

 

Regards,

Anthony Ferry

I have the same question (0)
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @AnthonyFerry , 

     

    It actually looks good. I didn't saw this myself.
    Can you please show us also your updateView function...
    In the init usually the values are not provided, but they should be provided in updateView.
    Maybe you could log the value directly inside updateView, and observe it in the console.

    Maybe it could help to look at .raw instead of the .formatted. Not sure about that, but who knows.

     

  • cchannon Profile Picture
    4,702 Moderator on at

    Yeah, Init isn't guaranteed to have the field value in it. Odd, but true. You need to attach to updateView instead, but even this one isn't guaranteed to have the value on every call, so you also need to handle it carefully. Generally, I just take as an assumption that I will not have bound input params during init at all and that updateView will only have values in bound params the second time it gets called. That kind of assumption helps me write safe code for times when you aren't totally sure when the value is going to show up.

     

    I would suggest you:

    • Add a boolean global param for _numberInitialized or something like that
    • Move your initializePhoneNumber() invocation to the updateView function
    • Only call initializePhoneNumber if _numberInitialized is false and your bound param is not null.
    • When you hit initializePhoneNumber and the value is not null, set _numberInitialized to true and proceed as normal

    This approach will always run when the value is there and it won't run unnecessarily often if you potentially get a lot of updateView events.

  • AnthonyFerry Profile Picture
    4 on at

    @DianaBirkelbach@cchannon 

     

    That's what I saw after some research on this point. Init() function does not guarantee to provide data. That's why I added to my code (that I didn't shared with you, sorry) a condition in my update function that calls the initializePhoneNumber() func only if I didn't get any data from context.

     

    AnthonyFerry_0-1635234251417.png

     

    But that doesn't resolve my problem. 

    It's like sometimes, the data is not provided at all to the control which is weird.

    Is it something crazy to execute a fetch query at the init that will search the current record field I need to populate ?

    It sound a bit heavy to my ears but I may be wrong 😕 

  • AnthonyFerry Profile Picture
    4 on at

    Maybe it could help to look at .raw instead of the .formatted. Not sure about that, but who knows.

     


    I may not have been precise enough but when I don't get any data, it concerns the raw and the formatted parts of the value.

  • cchannon Profile Picture
    4,702 Moderator on at

    Yeah, again, even the updateView is not guaranteed to have a value in it every time. updateView might get called 2 or 3 times while the form is loading. The first might not have a value, but by the last time it fires, it should have everything you need. so inspect the updateView context for your value and run your initializePhoneNumber only once it comes in with a value.

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 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard