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 Platform Community / Forums / Power Apps / sometimes PCF not gett...
Power Apps
Answered

sometimes PCF not getting field value

(0) ShareShare
ReportReport
Posted on by 12

I'm developing a PCF for OptionSet attributes in a model driven app for Dynamics 365. We're using this PCF multiple times on the same form.

 

For some attributes the PCF is not getting any value in context.parameters.OptionSet.raw. This happens only sometimes though. I've tested this using the same record: one time I open it and it may work as expected, but the next time there might just be no value being passed. I created logging in the init and updateView functions and I'm just getting undefined in those cases.

 

The desired value is definitely set in the record (I've verified this by getting the record via CDS). I disabled all the Form scripts, there are no business rules, and there are no onChange scripts.

 

Has someone here run into this?

I have the same question (0)
  • Verified answer
    Softwareschmid Profile Picture
    12 on at

    tldr;

    Don't call notifyOutputChanged from updateView.

     

    You know those times when you're stuck on a problem for hours, then you ask someone else, and shortly after that you solve it yourself?

     

    I disabled all UI generation in my PCF so there's only logging happening. Turns out that sometimes the logs looked like this:

    • init gets called with the correct value
    • updateView gets called with the correct value

    and sometimes like this:

    • init gets called with no value
    • updateView gets called with no value
    • updateView gets called again, with the correct value

    In my PCF the magic happens in a function that takes in the value as a number, does its UI magic, and at the end calls notifyOutputChanged. This function was called when the user used the UI as intended (registered on UI events), but also when updateView was being called. So when it's called the first time with no value it reports this exact missing value back to the model driven app, making it think that there's no value supposed to be set in the first place, and after that the PCF won't recieve the correct value anymore. Not calling notifyOutputChanged from updateView but only when the user initiated this function solved my issue.

     

    Now as to why the PCF would sometimes get called with no value in the first place is beyond me.

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

#2
Kalathiya Profile Picture

Kalathiya 321

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 311 Super User 2025 Season 2

Last 30 days Overall leaderboard