CRM 2015 – Javascript – Execution Context




This one can be quite interesting, the possibility of interacting with data from a plugin trough the Javascript, for now, i’m not seeing any example, but definitively is one to have a look, and what i think is quite interesting is regarding with  getSharedVariable and  setSharedVariable.

When you associate a function in a JavaScript library to an event handler in Microsoft Dynamics CRM, you can check the Pass execution context as first parameter option. The following table lists the execution context object methods.

Method Description

getContext

Returns the Xrm.Page.context object. See Client-side context (client-side reference) for more information.

getDepth

Returns a value indicating the order in which this handler is executed.

getEventSource

Returns a reference to the object that the event occurred on.

getSharedVariable

Retrieves a variable set using setSharedVariable .

setSharedVariable

Sets the value of a variable that can be used by a hander after the current handler finishes.

Use the getEventSource method in functions to make them more generic. For example, if you have a function that formats a telephone number, you can use the getEventSource method to refer to whatever attribute caused the onChange event. Your functions do not need to reference a specific attribute.

Hope it gives you new ideas to extend even more CRM. 

0 views0 comments

Recent Posts

See All