Execution context (client-side reference)

Execution context (client-side reference)

 

Applies To: Dynamics CRM 2016, Dynamics CRM Online

The execution context is an optional parameter that can be passed to a JavaScript library function through an event handler. This option is presented in the handler properties dialog when you specify the name of the function. This option is set for a <Handler> (FormXml) element using the passExecutionContext attribute.

Execution context is automatically passed to functions set using the Xrm.Page.data.addOnSave and Xrm.Page.data.entity Attribute.addOnChange, and Xrm.Page.ui Control.addPreSearch methods.

getContext

Method that returns the Client-side context (client-side reference) object.

getDepth

Method that returns a value that indicates the order in which this handler is executed.

getEventArgs

Method that returns an object with methods to manage the Save event.

getEventSource

Method that returns a reference to the object that the event occurred on.

Shared variables

Shared variables allow sharing of a variable with other handlers for the same event. You use the setSharedVariable and getSharedVariable methods to work with shared variables.

Method that returns the Client-side context (client-side reference) object


ExecutionContextObj.getContext()
Return Value

Type: Object

Method that returns a value that indicates the order in which this handler is executed.

Return Value

Type: Number

The order begins with 0.

Method that returns an object with methods to manage the Save event.

System_CAPS_noteNote

This method returns null for any event other than the Save event.


ExecutionContextObj.getEventArgs()
Return Value

Type: Object

More information: Save event arguments (client-side reference).

Method that returns a reference to the object that the event occurred on.


ExecutionContextObj.getEventSource()
Return Value

Type: Object

This method returns the object from the Xrm.Page object model that is the source of the event, not an HTML DOM object. For example, in an OnChange event, this method returns the Xrm.Page.data.entity attribute object that represents the changed attribute.

Shared variables allow sharing of a variable with other handlers for the same event. You use the setSharedVariable and getSharedVariable methods to pass variables between functions.

Sets the value of a variable to be used by a handler after the current handler completes.


ExecutionContextObj.setSharedVariable(key, value)
Arguments

String: The name of the variable

Object: The value to set.

Retrieves a variable set using setSharedVariable.


ExecutionContextObj.getSharedVariable(key)
Arguments

String: The name of the variable.

Return Value

Type: Object

The specific type depends on what the value object is.

Microsoft Dynamics CRM 2016 and CRM Online

© 2016 Microsoft. All rights reserved. Copyright

Community Additions

ADD
Show:
© 2016 Microsoft