Adding Knowledge article in custom entity side panel

There could be a requirement to assist users with knowledge when there are no apps – sales, voice of customer etc installed in the instance. In this case, we will have to enable users access to published knowledge articles.

To achieve the above requirement is quite easy, we will make use of the Xrm.App.sidePanes.getPane APi. First, let’s describe the scenario, we have a custom table and would like to expose the article to users via a side panel. The side panel will be an existing entity record.

There are three pre-requite to achieving the desired required:

  • Set Knowledge article in your custom model-driven app here
  • Enable knowledge article for the entity to be displayed in the side panel in the knowledge article settings.
  • Add the knowledge article control on the form to be viewed in the side panel

After the above configuration, all that is needed is to add the below code on load of the entity form.

function OpenSidePanel(){
    //check if the panel already exist
    //if it does, return and do nothing
    if(Xrm.App.sidePanes.getPane("kbarticle")) return;

    //else create the side panel
       Xrm.App.sidePanes.createPane({
           title: "Knowledge Article",
           imageSrc: "WebResources/msfp_FormsProIcon_32_32.svg",
           paneId: "kbarticle",
           hideHeader: true,
           canClose: true,
           width: 400
       }).then((pane) => {
           pane.navigate({
              //the record you want rendered on the side panel of the form.
               pageType: "entityrecord",
               entityName: "ve_applicat",
               entityId: "e405b215-7dce-ed11-b597-000d3a4aed4a",
           })
           Xrm.App.sidePanes.state = 0;
       });
       
   }

When I open the form, I get the below:

Using the side panel, users can search for every published article.