Part 15.4 - Understanding Client API and Form Context in JavaScript Dynamics 365 CRM
1. Understanding Client API Objects:
==> Client API is a collection of JavaScript libraries that can be used to perform operations on forms, fields, and entities. It is commonly used for:
Benefits of Using Client API
Overview of Form Context:
==> In Dynamics 365 CRM, Form Context is a crucial concept when working with JavaScript.
==> It allows developers to interact with form data, controls, and UI elements dynamically.
==> Understanding Form Context helps you customize forms, perform data manipulation, and execute custom business logic using JavaScript.
2. What is Form Context:
==> Form Context refers to the object that provides access to the current form and its data in Dynamics 365 CRM.
==> It allows JavaScript to read and manipulate the form fields, sections, tabs, and other UI components.
==> The Form Context object is the entry point to interact with fields, controls, and form data using Client API.
==> You can access the form context using the executionContext parameter in your function:
Why Use Form Context:
3. What is Execution Context:
Syntax:
4. Accessing Form Context in JavaScript:
==> We can access various form elements using Form Context.
Step 1: Accessing Field Values
Get and Set Field Value:
Step 2: Accessing Form Controls
==> Controls are the visual representation of fields on the form.
==> You can hide, disable, or enable controls using JavaScript.
Recommended by LinkedIn
Step 3: Accessing Sections and Tabs
5. Form Events in Dynamics 365 CRM
==> You can register JavaScript functions to execute on different form events using the Form Context.
Event Types:
Example 1: OnLoad Event:
This event is used to perform actions when a form is opened.
Explanation:
Example 2: OnChange Event
Explanation:
Example 3: OnSave Event
==> You can validate data before the form is saved using the OnSave event.
Explanation:
6. Working with Notifications Using Form Context:
==> You can display notifications using JavaScript to provide feedback to users.
Types of Notifications:
Example 1: Form Level Notification
Explanation:
Example 2: Field Level Notification:
Explanation:
Best Practices for Using Form Context