@@ -91,4 +91,149 @@ declare namespace Xrm {
9191 */
9292 setVisible ( visibility : boolean ) : void ;
9393 }
94+
95+ type KBSeachControlMode = "Inline" | "Popout" ;
96+
97+ /**
98+ * Interface for a KBSearchResult returned on the method getSelectedResults from the KBSearchControl.
99+ * All Date objects will be in the current user's time zone and format.
100+ */
101+ interface KBSearchResult {
102+ /**
103+ * The HTML markup containing the content of the article.
104+ */
105+ answer ( ) : string ;
106+
107+ /**
108+ * The article ID in Dynamics 365.
109+ */
110+ articleId ( ) : string ;
111+
112+ /**
113+ * The unique article ID in Dynamics 365.
114+ */
115+ articleUid ( ) : string ;
116+
117+ /**
118+ * The date the article was created.
119+ */
120+ createdOn ( ) : Date ;
121+
122+ /**
123+ * Indicates whether the article is associated with the parent record or not.
124+ */
125+ isAssociated ( ) : boolean ;
126+
127+ /**
128+ * Date on which the article was last modified.
129+ */
130+ lastModifiedOn ( ) : Date ;
131+
132+ /**
133+ * Support Portal URL of the article; blank if Portal URL option is turned off.
134+ */
135+ publicUrl ( ) : string ;
136+
137+ /**
138+ * Indicates whether the article is in published state. True if published; otherwise False.
139+ */
140+ published ( ) : boolean ;
141+
142+ /**
143+ * The title of the article.
144+ */
145+ question ( ) : string ;
146+
147+ /**
148+ * The rating of the article.
149+ */
150+ rating ( ) : number ;
151+
152+ /**
153+ * A short snippet of article content that contains the areas where the search query was hit.
154+ */
155+ searchBlurb ( ) : string ;
156+
157+ /**
158+ * Link to the article in the Dynamics 365.
159+ */
160+ serviceDeskUri ( ) : string ;
161+
162+ /**
163+ * The number of times an article is viewed on the portal by customers.
164+ */
165+ timesViewved ( ) : number ;
166+ }
167+
168+ /**
169+ * Interface for a knowledge base search control.
170+ */
171+ interface KBSearchControl extends BaseControl {
172+ /**
173+ * Add an event handler to the PostSearch event.
174+ * @param functionRef The function to add.
175+ */
176+ addOnPostSearch ( functionRef : ( context ?: ExecutionContext < this, undefined > ) => any ) : void ;
177+
178+ /**
179+ * Add an event handler to the OnResultOpened event.
180+ * @param functionRef The function to add.
181+ */
182+ addOnResultOpened ( functionRef : ( context ?: ExecutionContext < this, undefined > ) => any ) : void ;
183+
184+ /**
185+ * Add an event handler to the OnSelection event.
186+ * @param functionRef The function to add.
187+ */
188+ addOnSelection ( functionRef : ( context ?: ExecutionContext < this, undefined > ) => any ) : void ;
189+
190+ /**
191+ * Get the text used as the search criteria for the knowledge base management control.
192+ */
193+ getSearchQuery ( ) : string ;
194+
195+ /**
196+ * Get the currently selected result of the search control; the one that is currently open.
197+ * @return The currently selected result.
198+ */
199+ getSelectedResults ( ) : KBSearchResult ;
200+
201+ /**
202+ * Gets the count of results found in the search control.
203+ * @return The count of the search result.
204+ */
205+ getTotalResultCount ( ) : number ;
206+
207+ /**
208+ * Opens a search result in the search control by specifying the result number.
209+ * @param resultNumber Numerical value specifying the result number to be opened. Required.
210+ * @param mode Specify "Inline" or "Popout". Optional. Defaults to "Inline".
211+ * @return Returns 1 if successful; 0 if unsuccessful; -1 if the specified resultNumber is not present, or if the specified mode is invalid.
212+ */
213+ openSearchResult ( resultNumber : number , mode ?: KBSeachControlMode ) : number ;
214+
215+ /**
216+ * Use this method to remove an event handler from the PostSearch event.
217+ * @param functionRef The function to remove.
218+ */
219+ removeOnPostSearch ( functionRef : Function ) : void ;
220+
221+ /**
222+ * Remove an event handler from the OnResultOpened event.
223+ * @param functionRef The function to remove.
224+ */
225+ removeOnResultOpened ( functionRef : Function ) : void ;
226+
227+ /**
228+ * Remove an event handler from the OnSelection event.
229+ * @param functionRef The function to remove.
230+ */
231+ removeOnSelection ( functionRef : Function ) : void ;
232+
233+ /**
234+ * Set the text used as the search criteria for the knowledge base management control.
235+ * @param text The text for the search query.
236+ */
237+ setSearchQuery ( text : string ) : void ;
238+ }
94239}
0 commit comments