Using JavaScript in Editable Grid
JavaScript is used in Dynamics 365 to provide customer-side validation, and for other client-side requirements. Editable grids also support JavaScript. The editable grid supports three types of events, which are mentioned in the following points:
- OnRecordSelect – This event is triggered when the user selects a record in an editable grid
- OnChange – This event is triggered when any of the columns on the editable grid entity row is changed
- OnSave – This event is triggered by the Save button
The following gives a brief example of using JavaScript with Editable Grid:
Following is a scenario, which we will implement on an editable grid for opportunity:
- If the probability is greater than 70%, then set the rating of opportunity to hot
- If the probability is between 50% to 69%, then set the rating to warm
- If the probability is less than 50%, then set the rating to cold
Note
Prerequisite: To start working on this example, first add out of box fields, namely Rating
and Probability...