| Hammad Hussain
Client-Side Scripting in Dynamics 365
In this blog, we'll focus on how to add client-side scripting to a Model Driven Application. Read on to learn how to utilize a client-side script in Model-driven or Dynamics 365 Forms, as well as what methods and techniques are available. I'll try to cover as much information as possible to gain a thorough understanding of the implementation of client-side script on model-driven apps and Dynamics 365.
What is Client-side scripting on Model Driven App?
Client-side script allow us to utilize JavaScript on model driven app to execute custom business logic. This ought to be utilized as an alternative on the off chance that standard model driven app business rules don't meet the necessities. Client-side scripting will assist with carrying out custom business logic.
Client-Side scripts runs on model driven apps with reaction to form level events, for example – form on load event, form on save event, field on change event, command bar button click event.
Now, let’s have a look at some possible tasks that can be accomplished with Javascript client-side scripting.
- Get values or set values of fields in a form
- Show or hide UI components such as sections, tabs and fields
- Switching different forms on Model Driven application, if have multiple forms
- Open another form, reports, dialog box and to call custom web resource.
- Make interactions with Business process flows including stages and fields inside of stages.
Event Handlers
Client Script logic runs as event handler for the form events. Here we should register event on form to execute the logic and a few events can be executed from code.
The most effective method to register Client script on Model driven form with assistance of Event Handlers. In the Form designer you can put different event handlers for events such as:
Form: It lets you create an event on form’s OnLoad and OnSave property for event handling.
Fields: It lets you create an event on Field’s OnChange property, such as hiding another field based on this field or setting a value for another field when some change is made to this field.
Tabs: It lets you create an event on Tab’s “On Tab State Change” property for event handling.
Conclusion
Client-side scripting plays a necessary role in Dynamics 365 especially when customizations are required that can not be accomplished by an OOB functionality. It can be used for a variety of functionalities such as validations on forms, adding custom buttons to the command bar, customizing UI, customizing business process flows and much more.
Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.