In the blog, we will see how easy is to convert existing code with Xrm . Page to use the new form Context object.
There are significant changes made to client-side APIs in Dynamics 365 V9.X releases. Below are some of the main changes you will find in the latest version:
Execution Context | It defines as event context in which code executes. Using execution context, we can retrieve form or grid context instead of Xrm.Page which is deprecated in the next release. |
Global Context | A new API added to the Xrm.Utility object to retrieve information specific to Organization, user and client. It is equivalent to Xrm.Page.context object (i.e; deprecated ). |
New Client APIs | Number of new APIs are, Xrm.Device, Xrm.Encoding, Xrm.Navigation, Xrm.WebApi |
Some Deprecated APIs are | Xrm.Page, Xrm.Page.Context, Xrm.Mobile.offline, parent.Xrm |
Execution Context: From the above definition we understand what execution context is, now we see how we pass to our new codes. We can pass this in two ways:
- Pass through UI: Execution context is an optional parameter that can be pass to JavaScript library function through an event handler, by selecting Pass execution context as the first parameter in event handler properties dialog.
- Pass through code:Execution context is automatically passed as the first parameter to the function.