cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DianaBirkelbach
Super User
Super User

PCF on Portals: updateView not called after the value changed

I've tried out some of my field PCFs on Portals following the tutorial: https://docs.microsoft.com/en-us/powerapps/maker/portals/component-framework-tutorial?WT.mc_id=BA-MV...

It worked like a charm. 

The only problem that I've found out: after we change a value (and call the notifyOutputChanged) the updateView is not called again (only getOutputs).

Usually the PCFs wait for the framework runtime to validate the input, and are designed to wait for updateView to be called with the new value.  At least this worked until now for Model-Driven and CanvasApps PCFs, and was described here: https://docs.microsoft.com/en-us/learn/modules/get-started-component-framework/2-architecture?WT.mc_...

 

Since the updateView is not called, my controls don't show the changed value (but they gets saved), 

I suppose the Portals have another framework runtime, so I would like to ask if the portal PCFs are supposed to work this way. That would add some complexity to the controls, since the value is set both inside the PCF and outside through the updateView.

 

Or maybe not calling the updateView is just a bug for now, and we don't need to change the PCFs.

 

@HemantG , maybe you can help to clarify this.

 

Kind regards,

Diana

Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
8 REPLIES 8
HemantG
Power Apps
Power Apps

Ack - Following up on this . 

 

Thanks,

Hemant 

gonara
Microsoft
Microsoft

Hi @DianaBirkelbach , Thanks for trying PCF on portals out and bringing this to our notice. 

Can you please give us more details about how you are changing the value? Is it part of the component itself ? Also, if possible, can you share the component that you are using so that we can test and confirm from our end?

This seems to be a bug on our end and the PCFs need not be changed just for portals. This is what we are trying to achieve. 

 

If you are changing the value of the control using client scripts in Portals, you could do so using the below snippet.

 

var hiddenFieldSelector = 'input[id$=' + logical name of the attribute + ']'; 
$(hiddenFieldSelector).val(JSON.stringify(NewValue)).change();

 

Thanks,

Gokul

DianaBirkelbach
Super User
Super User

Thank you so much @gonara .😀


An example would be the ColorfulOptionset: https://github.com/ORBISAG/ORBIS.PCF.ColorfulOptionset

Inside my own react component, I don't keep the value in the state: I rely on having my component called through updateView after the value was validated by the framework.

Maybe there is a better way to use the Dropdown Control (it was my first PCF), but I also have another PCF made with own created react component (without FluentUI), and I have there the same problem, since my component only needed the starting value, and onClick I only needed to notify the framework. I thought it was easier, and it worked until portals. In case you would like that code too, I can send it to you in a private message.
I didn't use any scripts in portals to change the value.
 
Kind regards,
Diana
Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
gonara
Microsoft
Microsoft

Ack. Will check this out. Thank you so much for the inputs.

Hi Diana, 

Thank you again for bringing this to our notice. This indeed was a bug on our side. This is fixed and should be available with the next release. I tested with the ColorfulOptionset that you had shared and is working fine now. Also if possible can you share the solution of the other PCF that you were having troubles with, so that I can test and confirm that it fixes all scenarios?

 

Thanks,

Gokul

Abhishekchopra
Frequent Visitor

Is it now available ?

DianaBirkelbach
Super User
Super User

Hi @Abhishekchopra , 

 

Yes, it was fixed short after reporting this.

Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Abhishekchopra
Frequent Visitor

In my case:

Still when we are creating new pcf component, after using notifyOutputChanged, it is triggering UpdateView only on local but after deploying to portal, it's not triggering UpdateView.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,514)