Implementing Custom Plugins

Custom plugins can be added to the system by navigating to Plugins → Plugin Codes within Voice for D365 Configurator app.

By creating a new item, the display name and source code of JavaScript plugin can be typed.

Here is an example of how the source code of a plugin should look like:

var SampleCustomer = SampleCustomer || {}; SampleCustomer.Plugins = SampleCustomer.Plugins || {}; SampleCustomer.Plugins.test = async function(context) { debugger; console.log("[voice] foo"); };

One plugin code file can contain any number of plugins. The entry point of a plugin is a JS function, like SampleCustomer.Plugins.testin the example above.

The entry point of the plugin must always be asynchronous (decorated with async statement or returning a promise object).

The code of the plugin must also handle any asynchronous operations (with await statement or handling promises properly) and wait until e.g. the result of a WebAPI query is returned. The recommended way of implementation is to use asnyc-await, to simplify the code and minimize errors.

After typing the source code, all the plugins within the code file must be registered by navigating to Plugins → Plugin Definitions. A new item must be created by giving

  • display name

  • CIF version (this can't be modified after creation)

  • JS function name (full name including namespace)

  • Plugin code selected

When the custom plugin has been created this way, it can be added to any event the same way as any built-in plugin (except the different order number space).

© Enreach, Mannerheimintie 117, 00280 Helsinki, Finland
+358 40 450 3000, www.enreach.fi