Client API execution context

Applies to Dynamics 365 (online), version 9.x

The execution context defines the event context in which your code executes. The execution context is passed when an event occurs on a form or grid, which you can use it in your event handler to perform various tasks such as determine formContext or gridContext, or manage the save event.

The execution context is passed in one of the following ways:

  • Defining event handlers using UI: The execution context is an optional parameter that can be passed to a JavaScript library function through an event handler. Use the Pass execution context as first parameter option in the Handler Properties dialog while specify the name of the function to pass the event execution context. The execution context is the first parameter passed to a function.

    Pass execution context

  • Defining event handlers using code: The execution context is automatically passed as the first parameter to functions set using code. For a list of methods that can be used to define event handlers in code, see Add or remove functions to events using code.

The execution context object provides a number of methods to further work with the context. More information: Execution context (Client API reference)

Client API form context
Client API grid context
Form and grid context in ribbon actions