Open the respective Knowledge Base search result using the openSearchResult API

  • The first one is the resultNumber which is nothing but any numeric value starting from 1. This is the parameter where we can mention which article from the list of search results we want to open directly on every search. If we want to open the first record the value should be 1, for the second record the value should be 2 and so on.
  • The second parameter defines how we want to view the opened article. Whether we want to view it as an “Inline” or “Popout”. If nothing is passed then by default it is “Inline”.
  1. Returns 1 on successful Status of opening the specified search result.
  2. Returns 0 on unsuccessful Status of opening the specified search result.
  3. Return -1 if the specified resultNumber value is not present, or if the specified mode value is invalid.
  • Record to be opened — This will be a whole number field on the form which would be used by the user to enter the result number to be opened.
  • Record Present? — This will be a Boolean field which will act as a flag to notify the users that the specified record is present or not.
var new = window.Sdk || {}; 
new.KBSearchOnResultOpened = function (executionContext) {
//Getting the formcontext
var formContext = executionContext.getFormContext();
//Getting field control
var productKBControl = formContext.getControl('Product_Knowledge_Base');
//Getting the user specified number
var count = formContext.getAttribute('new_searchresultcount').getValue(); //Calling the openSearchResult client API
var openResultStatus = productKBControl.openSearchResult(count);
//Setting the recordPresent field to Yes/No
openResultStatus == 1 ? formContext.getAttribute('new_countpresent').setValue(true) : formContext.getAttribute('new_countpresent').setValue(false);


As illustrated above, OpenSearchResult Client API will improve the user experience and make the existing feature more flexible to use.



Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store