Dynamics 365 – How to Trigger OnChange Event of an Attribute

fireOnChange() function is used to trigger the registered onChange events of an attribute. It is also very useful when you update an attribute through Javascript Code and it onChange event doesn’t trigger.

When you update an attribute from Javascript code, its onChange event doesn’t trigger. If you want it to be triggered, you have to use fireOnChange()

FireOnChangeTest: function (executionContext) {
var formContext = executionContext.getFormContext();
// You first update the value of the "myAttribute"
// Then You want to trigger onChange event of the "myAttribute".
formContext.getAttribute("myAttribute").setValue(newValue);
formContext.getAttribute('myAttribute').fireOnChange();
}
view raw FireOnChange.js hosted with ❤ by GitHub

One response to “Dynamics 365 – How to Trigger OnChange Event of an Attribute”

  1. […] code, its onChange event doesn’t trigger. If you want it to be triggered, you have to … Continue reading Dynamics 365 – How to Trigger OnChange Event of an Attribute Read Complete Post and Comments SBX – Two Col […]

Leave a comment