...
Address and City columns of the grid can be fully customized, plus name replaced using a custom plugin. The example code of such a plugin:
Code Block | ||
---|---|---|
| ||
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"]); }; |
The context parameter of the JS plugin function contains a customerSearchResults
property. It is an instance of Enreach.API.customerSearchResults
class, which has the following methods:
dataRows property
An array of objects found by multiple matches feature. Each item within the array has the following properties:
id: GUID of the entity
name: display name
type: entity logical name
fieldValues: additional fields displayed in the grid
By iterating the array of search results, additional information can be retrieved for each one by using CIF CRUD APIs.
setColumnHeaders(columnHeaders) function
Manipulates the column headers of the grid. Only Address and City columns ca be overridden. Default columns are removed when the method is called.
columnHeadercolumnHeaders: string array of column headers
...
setRowData(id, name, fieldValues) function
Updates the values of a particular item.
id: primary key (GUID) of the item
name: the value which should be displayed in Name column of the grid
fieldValues: array of additional field (string) values to be displayed
addRow(id, name, type, fieldValues, iconPath) function
Adds a new item to search results. Can be used to add extra content to the grid on top of the ones found by OoB logic.
id: primary key (GUID) of the item to be added
name: the value which should be displayed in Name column of the grid
type: logical name of item (account or contact)
fieldValues: array of additional field (string) values to be displayed
iconPath: must be null when adding contacts or accounts. It is reserved for future use, to be able to list other entity types as well. Atm. only accounts and contacts are supported.
hideRow(id) function
Available from v1.2.2 on.
Marks the item with the specified id as hidden.
Such rows will not be rendered by multiple matches list. If only one single item remains visible, the rest will be treated as if only one item was found:
Multiple matches list is not visible
The single item (account or contact) is set as the context of call
The number of columns given to setColumnHeaders and length of fieldValues array on addRow and setRowData functions have to be identical. Within the plugin all the features of The API throws an error if the number of columns don’t match.
All the features of Microsoft CIF API can be used within the plugin, e.g. to retrieve any record and supply the retrieved data to setRowData function.
...
var contact = await Microsoft.CIFramework.retrieveRecord("contact", id, "?$select=fullname,telephone1");
The custom plugin then has to be inserted right before the grid is rendered by Display Customer search results OoB plugin on Incoming call answered event.
...