Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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.manipulateSearchResults = async function(context) {
    debugger;
    context.customerSearchResults.setColumnHeaders(["foo", "bar"]);
    context.customerSearchResults.setRowData("b41a1595-e321-ec11-b6e6-6045bd8a1d39", "foo", ["bar", "qwe"]);
};

One plugin code file can contain any number of plugins. The entry point of a plugin is a JS function, like SampleCustomer.Plugins.manipulateSearchResults in 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).

  • No labels