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

Community site session details

Session Id : fSOil1q3dyv2ft95Z5jHiu
Power Apps - Power Apps Pro Dev & ISV
Answered

Bound property not populated when PCF standard control initialized

Like (0) ShareShare
ReportReport
Posted on 8 Mar 2021 18:44:20 by 159

We are seeing a weird phenomenon in several customer environments where a standard control bound property is not populated during the init lifecycle event i.e. is null whenever we reach into the property bag to get the value.

 

Interestingly, if we wait a bit and try again, the value is populated in the property bag. 

 

 

<property ...... of-type="SingleLine.Text" usage="bound" required="true" />

// Comes in as null
console.log('MyProp is available: ', this._context.parameters.myprop.raw === null);

// However, if we wait a bit and try again
if (this._context.parameters.myprop.raw === null) {
 setTimeout(async () => {
 // No longer null 
 console.log('MyProp is available: ', this._context.parameters.myprop.raw === null);
 }, 3000);
}

 

 

Can anyone explain why we would see this behavior in some circumstances? 

 

Thanks in advance,

Irvin 

  • iwaldman Profile Picture
    159 on 08 Mar 2021 at 20:47:18
    Re: Bound property not populated when PCF standard control initialized

    Hi @DianaBirkelbach

    Thanks for sharing the blog post. I've scratched my head a few times wondering about this. Knowing what I know now, future controls will be constructed a bit differently. 🙂 

     

    Thanks, Irivn 

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on 08 Mar 2021 at 20:41:24
    Re: Bound property not populated when PCF standard control initialized

    Hi @iwaldman , 

    As @cchannon  said, the update view will be called when the value is available or gets changed. 

    updateView is called actually quite often. In case you would like to see all the cases, you can find this in my blog: https://dianabirkelbach.wordpress.com/2020/03/29/pcf-when-is-updateview-called/
    Kind regards,

    Diana

  • Verified answer
    cchannon Profile Picture
    4,702 Moderator on 08 Mar 2021 at 20:17:02
    Re: Bound property not populated when PCF standard control initialized

    "updateView: This method will be called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, offline status, component metadata values such as label, visible, etc."

    updateView - Power Apps | Microsoft Docs

  • iwaldman Profile Picture
    159 on 08 Mar 2021 at 20:04:34
    Re: Bound property not populated when PCF standard control initialized

    Thanks for the response.

     

    What you describe is what I deduced in my testing. I've implemented a retry capability with exponential backoff and show a spinner until the value appears or exhaust retries. However, if I can assume that updateView will eventually get called when the value finally becomes available, then the retry is unnecessary. 

     

    Is what you describe above documented along with best practices?

  • cchannon Profile Picture
    4,702 Moderator on 08 Mar 2021 at 19:56:05
    Re: Bound property not populated when PCF standard control initialized

    The init event does not guarantee you'll have values in your bound input objects. I don't speak for MSFT of course, but I suspect that it is because the PCFs render while the form is still building, which is before Dataverse has even made the retrieve call for all field values.

     

    To be sure you're getting your input values, you should ensure that everything that needs those values cascades from the updateView function instead. This function gets called multiple times during a form load and after; essentially every time it is even possible that the value has changed. This makes it an objectively a better spot to bind your renderings, even if the value were guaranteed to be there during init.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete