cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Refresh PCF on bound field change / my first Event Listener

Hello All,

 

I'm hoping someone can point me in the right direction, I have a PCF with a input parameter of a bound Lookup.Simple field. Based on the value in this field I change the data displayed in my PCF which is attached to a Multi-Line of text field. Everything is working as expected but I would like to have the PCF refreshed each time the input parameter bound Lookup value is changed.

 

From my research it looks like I need to use _notifyOutputChanged(); but can see it being used in various different ways and i'm unsure on how to directly link to the value that would be changed in the lookup.

 

Is there any good documentation on this or does anyone have an example of implementing the above logic that I can reference?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Refresh PCF on bound field change / my first Event Listener

Hi @TomPhillips 

 

When you call the "notifyOutputChanged()", the framework runtime will call your "getOutputs" method.

In the getOutputs, you can return the new values for your properties which were changed. Here are the docs for getOutputs: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/control/getoutput...

 

After the getOutputs is called by the runtime, the values will be evaluated, and the your "updateView" method will be triggered. So the updateView is the method where you could refresh your PCF. I have written a blog about the updateView and the triggers for it, in case you want to read more on this: https://dianabirkelbach.wordpress.com/2020/03/29/pcf-when-is-updateview-called/

 

I am a little confused because you use a lookup parameter. In the docs the lookup property is still documented as unsupported and I remember that it was not possible to choose PCFs for a lookup control: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/manifest-schema-reference/p....

Have you used some unsupported techniques for the lookup property? Or maybe does it works now, even if the docs are not changed?

 

Hope it helps.

 

Kind regards,

Diana

 

 

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Refresh PCF on bound field change / my first Event Listener

Hi @TomPhillips 

 

When you call the "notifyOutputChanged()", the framework runtime will call your "getOutputs" method.

In the getOutputs, you can return the new values for your properties which were changed. Here are the docs for getOutputs: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/control/getoutput...

 

After the getOutputs is called by the runtime, the values will be evaluated, and the your "updateView" method will be triggered. So the updateView is the method where you could refresh your PCF. I have written a blog about the updateView and the triggers for it, in case you want to read more on this: https://dianabirkelbach.wordpress.com/2020/03/29/pcf-when-is-updateview-called/

 

I am a little confused because you use a lookup parameter. In the docs the lookup property is still documented as unsupported and I remember that it was not possible to choose PCFs for a lookup control: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/manifest-schema-reference/p....

Have you used some unsupported techniques for the lookup property? Or maybe does it works now, even if the docs are not changed?

 

Hope it helps.

 

Kind regards,

Diana

 

 

View solution in original post

Highlighted
Frequent Visitor

Re: Refresh PCF on bound field change / my first Event Listener

Hi Diana,

 

Thanks for the information, that gives me the information I need. Yes i enabled the Lookup-Simple type by adding it to the Manifest, currently not supported but works for my testing purposes.

 

Thanks again!

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (5,943)