Hi @DeviKrishna, thanks for the approach, means a lot.
BTW I just realized that my code works properly for the 1st time I update the field, both the fields get updated automatically. But the next time I update the 1st field it updates only that field and not the 2nd one. Any idea why?
Please follow these steps
In your app's form, make sure both Field 1 and Field 2 are using your custom PCF control as their control type.
By following these steps, when you select a value on Field 1, the custom PCF control's notifyOutputChanged method will be called. It will then update the view for Field 1 based on the selected value and notify Field 2 about the new value, triggering its update view as well. This way, both fields will stay in sync with each other when you interact with the custom control.
Inside your PCF control code, make sure you have defined two properties to hold the values for Field 1 and Field 2:
//Sample code
exportinterfaceMyControlProps
{
demofield1: number;
demofield2: number;
…..
}
Implement the notifyOutputChanged method in your control. This method will be called whenever a property value changes.
publicnotifyOutputChanged(inputs: PropertyBag): void
{ // Check if Field 1 value has changed
if(inputs.hasOwnProperty("demofield1"))
{
const demofield1 = inputs["demofield1"] as number;
this._notifyField2Updated(demofield1);
}
Define the _notifyField2Updated method in your PCF control to trigger the update view for Field 2:
private_notifyField2Updated(newValue: number): void
{
valuethis.notifyOutputChanged({ demofield2: newValue });
}
-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
My Blog: Dynamics 365 Key Topics – https://d365topicsbydk.com/
My YouTube Channel : https://www.youtube.com/channel/UCxSIryP2ah2VpEFr-Z72t1A
Regards
Devi
stampcoin
15
ankit_singhal
11
Super User 2025 Season 1
mmbr1606
9
Super User 2025 Season 1