Coveo for Dynamics JavaScript Search Component API Reference

Coveo for Dynamics comes with a set of JavaScript search page components that you can leverage to improve user experience (see Components). This page describes the options and properties of the components specific to Coveo for Dynamics. For details on how they can be beneficial to search page users and for indications as to how to implement these components via the JavaScript Search Interface Editor, see Search Page Components.

The information in this page is generated from comments in the source code.

For reference documentation regarding the general JavaScript Search Framework components, see Coveo JavaScript Search Framework - API Reference.

Components

Components are the building blocks of the Coveo JavaScript Search Framework (see Components ).

ContextualQueryFilter Component

Component HTML element class: CoveoContextualQueryFilter

The ContextualQueryFilter component specifies a query filter to apply at query time. This filter is not injected if a form context does not exist. Furthermore, it is possible to use Liquid syntax to inject contextual attributes into the filters.

Options

Option

(type)

Description
title

(string)

Specifies a title to show when displaying the component within the Coveo Interface Editor. Default value is Contextual Query.

Properties

Property

(type)

Description
constructor

Creates a new ContextualQueryFilter component.

ExtensionRefinedQuery Component

Component HTML element class: CoveoExtensionRefinedQuery

The ExtensionRefinedQuery component adds a contextual text part to a query. It uses the Coveo Machine Learning service to pick the most important keywords in the text and add them to the basic expression. This field is mainly used to pass context such a case description, a long textual query, or any other form of text that might help in refining the query. It is possible to inject contextual field values using the Liquid syntax.

Options

Option

(type)

Description
fieldsToInclude

Specifies a list of fields or texts from which to extract keywords. It is possible to inject contextual field values using the Liquid syntax.

Properties

Property

(type)

Description
constructor

Creates a new ExtensionRefinedQuery component.

ExtensionSome Component

Component HTML element class: CoveoExtensionSome

The ExtensionSome component adds a $some query extension to inject at query time. A $some query matches a subset of a list of provided keywords depending on the provided arguments.

Options

Option

(type)

Description
best

(number)

Either an absolute or a percentage value specifying that only the X best keywords among those provided are to be matched. Keywords that are less prevalent in the index are considered better than those that are very common. Default value is 5.

disableOnNonContextualSearch

(boolean)

Whether the expression should be disabled when context is disabled. Default value is true.

isContextual

(boolean)

Whether the expression contains context dependant values. Default value is true.

keywords

Specifies a list of fields or texts from which to extract keywords. It is possible to inject contextual field values using the Liquid syntax.

match

(number)

Either an absolute or a percentage value specifying that items containing only X or more keywords of those provided are to be matched. Default value is 5.

maximum

(number)

The maximum number of keywords to use. If a larger number of keywords is provided, the extra keywords are ignored. Default value is 100.

Properties

Property

(type)

Description
constructor

Creates a new ExtensionSome component.

ForDynamicsFormChangeDetector Component

Component HTML element class: CoveoForDynamicsFormChangeDetector

The CoveoForDynamicsFormChangeDetector component triggers a new Coveo search query when a CRM attribute changes.

Options

Option

(type)

Description
enableSearchAsYouType

(boolean)

Specifies whether to enable the Search as You Type feature. If true, the Coveo search interface updates its search results as user types. If false, a new query is triggered only when a form element loses focus. Default value is false.

Properties

Property

(type)

Description
constructor

Creates a new FormChangeDetector component.

ForDynamicsFormFieldValueQuerySyntax Component

Component HTML element class: CoveoForDynamicsFormFieldValueQuerySyntax

The ForDynamicsFormFieldValueQuerySyntax component enables usage of the Liquid query syntax.

Properties

Property

(type)

Description
constructor

Creates a new ForDynamicsFormFieldValueQuerySyntax component.

ForDynamicsQuickCreate Component

Component HTML element class: CoveoForDynamicsQuickCreate

The QuickCreate component opens a CRM form for users to create a new record. This component can also be rendered inside a search result template. In such case, clicking the component opens a form and populates it with search result field values.

Options

Option

(type)

Description
caption

(string)

Specifies the caption displayed when the component is rendered in the result action list.

entityId

(string)

Specifies the ID of the entity record to display the form for.

entityName

(string)

Specifies the logical name of the entity to display the form for.

formId

(string)

Specifies the ID of the form instance to be displayed.

formParameters

(IStringMap)

Specifies an array of fields to prepopulate in the opened form. Examples:

You can set the option in the 'init' call:

var myformParameters = {
  "title" : { "field": "@title"},
  "content" : { "value": "Hello World"},
  [ ... ]
};
Coveo.init(document.querySelector('#search'), {
   ForDynamicsQuickCreate : {
       formParameters : myformParameters
   }
})

Or directly in the markup:

<!-- Ensure that the double quotes are properly handled in data-form-parameters. -->
<div class='CoveoForDynamicsQuickCreate' data-form-parameters='{"title" : { "field": "@title"}, "content" : { "value": "Hello World"}}'></div>
maximumDocumentSize

(number)

Specifies the maximum preview size that the index should return. Default value is 0, and the index returns the entire preview. Minimum value is 0.

openInNewWindow

(boolean)

Specifies whether to display form in a new window. Default value is false.

title

(string)

Specifies the title displayed when hovering over the component.

useQuickCreateForm

(boolean)

Specifies whether to open a Quick Create form. Default value is true.

Properties

Property

(type)

Description
constructor

Creates a new QuickCreate component.

ForDynamicsTakeNote Component

Component HTML element class: CoveoForDynamicsTakeNote

The TakeNote component allows adding a note about a given search result on the context record.

Properties

Property

(type)

Description
constructor

Creates a new TakeNote component.

InsightContext Component

Component HTML element class: CoveoInsightContext

The InsightContext component is similar to the PipelineContext component, the difference being that the InsightContext component is used to inject CRM form field values into the query context.

Options

Option

(type)

Description
fieldsToInclude

Specifies a list of fields to include in the context. It is possible to inject contextual field values using the Liquid syntax.

Properties

Property

(type)

Description
constructor

Creates a new InsightContext component.

LinkToCase Component

Component HTML element class: CoveoLinkToCase

The LinkToCase component allows linking a CRM knowledge article to a case.

Options

Option

(type)

Description
linkCaption

(string)

Specifies the caption displayed beside the component when the knowledge article can be linked to the case. Default value is Link to case

linkTitle

(string)

Specifies the title displayed over the component when the knowledge article can be linked to the case. Default value is Link to case

unlinkCaption

(string)

Specifies the caption displayed beside the component when the knowledge article can be unlinked from the case. Default value is Unlink from case

unlinkTitle

(string)

Specifies the title displayed over the component when the knowledge article can be unlinked from the case. Default value is Unlink from case

Properties

Property

(type)

Description
constructor

Creates a new LinkToCase component.

OpenFullSearch Component

Component HTML element class: CoveoOpenFullSearch

The OpenFullSearch component renders a link to the main Coveo Search Page.

Options

Option

(type)

Description
renderInSettingsMenu

(boolean)

Specifies whether the component should be rendered under the Coveo Settings component. Default value is false.

text

(string)

Specifies the text content to add inside the icon HTML element. Default value is the localized string for GoToFullSearch.

<div class='CoveoOpenFullSearch' data-text='Go To Full Search'></div>
webResourceName

(string)

Specifies the name of the Coveo search page web resource to open. Default value is coveo_SearchPage.

Properties

Property

(type)

Description
constructor

Creates a new OpenFullSearch component.

Component HTML element class: CoveoPopup

The Popup component is a container in which you can drop any other content or component. Since the Coveo Insight Panel interface is designed to be embedded in a limited space within a CRM form, it might be useful to add a section that can be hidden or shown when clicked.

The HTML content inside the Popup div determines what is show it might be useful to add a section or closed.

<div class='CoveoPopup'>
  <div class='coveo-facet-column'>
    <div class='CoveoFacet' data-field='@myfirstfacet'></div>
    <div class='CoveoFacet' data-field='@mysecondfacet'></div>
    <div class='CoveoFacet' data-field='@mythirdfacet'></div>
  </div>
</div>
Option

(type)

Description

(boolean)

Specifies if the popup should open with the full available height of the page. Default value is false.

(boolean)

Specifies if the popup should open with the full available width of the page. Default value is false.

(boolean)

Specifies whether the component should be hidden. Default value is false.

(string)

Specifies the CSS class used for your icon.

(string)

Specifies the static title to display. Default value is Click here to open.

Property

(type)

Description

Creates a new Popup component.

QueryFilter Component

Component HTML element class: CoveoQueryFilter

The QueryFilter component specifies a query filter to apply at query time.

Options

Option

(type)

Description
Contextualtitle

(string)

Specifies a title to show when displaying the component within the Coveo Interface Editor. Default value is Contextual Query.

title

(string)

Specifies a title to show when displaying the component within the Coveo Interface Editor. Default value is Query Filter.

Properties

Property

(type)

Description
Contextualconstructor

Creates a new ContextualQueryFilter component.

constructor

Creates a new ForDynamicsFormFieldValueQuerySyntax component.

RemoveContext Component

Component HTML element class: CoveoRemoveContext

The RemoveContext component allows disabling the Dynamics contextual search.

Options

Option

(type)

Description
active

(boolean)

Specifies whether the switch is active by default. i.e., whether the context is disabled by default. Default value is false

label

(string)

Specifies the label of the switch. Default value is Remove context

Properties

Property

(type)

Description
constructor

Creates a new RemoveContext component.

ResultAction Component

Component HTML element class: CoveoResultAction

The ResultAction component displays a small actionable button for a given search result. When clicked, the button displays other subcomponents in a menu, such as the BoxQuickview Component. Note:

For more information on how to implement your own custom actions inside this component, see Creating Custom Actions for an Insight Panel or a Custom Box.

<div class='CoveoResultAction'>
  <!-- Include other components here, such as the BoxQuickView component -->
</div>

Options

Option

(type)

Description
menuDelay

(number)

Specifies the delay, in milliseconds, before the menu disappears when the user's mouse leaves the menu icon. Minimum value is 0.

Default value is 300.

Properties

Property

(type)

Description
constructor

Creates a new ResultAction component.

BoxQuickview Component

Component HTML element class: CoveoBoxQuickview

The BoxQuickview component inherits the Quickview component, and thus offers the same options(see Coveo Component Quickview).

Properties

Property

(type)

Description
constructor

Creates a new BoxQuickview component.

Component HTML element class: CoveoCrmResultLink

The CrmResultLink component ensures CRM search results URLs are properly configured with respect to the CRM context.

Option

(type)

Description

(boolean)

Specifies whether to use the XRM API or not. When this option is set to true external result links are opened using Xrm.Navigation.openUrl. Setting it to false leverages use web browser capabilities when using the Dynamics 365 web client. Default value is false.

Property

(type)

Description

Creates a new CrmResultLink component.