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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

How to Call a JavaScript Function on the Form from a PCF Control in Dynamics 365?

(3) ShareShare
ReportReport
Posted on by 1,135
We have a scenario where a PCF control is used on a form, and the same form includes a JavaScript web resource containing a function.


We want to call this JavaScript function from within the PCF control.

Could anyone guide us on achieving this or share any best practices for this integration?

Categories:
I have the same question (0)
  • Suggested answer
    Tom_Gioielli Profile Picture
    3,086 Super User 2026 Season 1 on at
    Can you use the PCF control to hit and update a trigger field on your form, and set the function to run when that field is changed? The field can be hidden on the form and marked as not-searchable, just used as a trigger point for your script?
     
    There are also lots of flavors of PCF controls. If my suggestion doesn't work, some more information on the type of control and what it is doing may help you find a solution.  For example, is this control on a subgrid of child records or directly on a field on your form? How is the script normally being triggered?
  • Satyam Prakash Profile Picture
    1,135 on at

    Thank you for the suggestion!

     

    We did explore the approach of using a trigger field and attaching our script to its onChange event. While this works when the user updates the field through the UI, it unfortunately doesn't trigger the onChange event when the field is updated programmatically via JavaScript. Based on our investigation, this behavior is by design, as programmatic updates  setValue do not automatically fire the onChange event.

    If there’s a workaround to explicitly trigger the onChange event after a JS update, or if there's a different recommended pattern when using PCF controls for this kind of scenario, we'd appreciate any insights.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 85

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 76 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 61

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans