Editar

Compartilhar via


addHandler (JavaScript API Reference) for Dynamics 365 Channel Integration Framework 2.0

Adds the subscriber to the events.

Note

This API can be used on both the widget and Unified Interface page.

Syntax

Microsoft.CIFramework.addHandler(eventName, handlerFunction);

Parameters

Name Type Required Description
eventName String Yes Name of the event for which the handler is set.
The supported events are:
  • onclicktoact: The event is invoked when the outbound communication (ClickToAct) field is enabled.
  • onmodechanged: The event is invoked when the panel mode is manually toggled between Minimized (0), Docked (1), and Hidden (2).
  • onsizechanged: The event is invoked when the panel size is manually changed by dragging.
  • onpagenavigate: The event is triggered before a navigation event occurs on the main page.
  • onsendkbarticle: The event is invoked when the user selects the Send button on the KB control.
  • onSessionClosed: The event is invoked when the session is closed.
  • onSessionSwitched: The event is invoked when the user switches from one session to another.
You can also pass custom events in the eventName parameter.
handlerFunction Function Yes The handler function is invoked when any of the supported events are triggered.

Example

The sample code demonstrates setting the addHandler method for the onmodechanged event.

handlerFunction = function(eventData) {
console.log(eventData)
return Promise.resolve();
}

Microsoft.CIFramework.addHandler("onmodechanged", handlerFunction);

onclicktoact
onmodechanged
onsizechanged
onpagenavigate
onsendkbarticle
onSessionClosed
onSessionSwitched