I have been trying to create a lwc that will only show the article title and body within our community. so far I am running into some trouble with the lightning record view form commnd and assigning a proper record id as our community has dynamic pages. i . am hoping that someone can help me figure out how to either hide the other fields or to just display the article body and title fields. I am using visual studio to create the lwc.


   <lightning-record-view-form record-id="ka0170000009rYcAAI" object-api-name="Knowledge__kav">
      <div class="slds-grid">
            <div class="slds-col slds-size_1-of-2">
                 <lightning-output-field field-name= "Title">
            <div class="slds-col slds-size_1-of-2">
                 <lightning-output-field field-name="Article_body__c"


// myComponent.js
import { LightningElement, api } from 'lwc';
export default class MyComponent extends LightningElement {
    @api recordId;


<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">

2 Answers 2


The lightning data service does not support the Knowledge__kav object as per the User Interface API guide. It is supported in Lightning communities container but your object is not supported. Hence, You need to explicitly make an apex call to get the record.

A sample example would be:-

        <template if:true={article}>

Javascript file:-

import { LightningElement, api, track} from 'lwc';
import findArticles from '@salesforce/apex/KnowledgeController.findArticles';

export default class ApexImperativeMethodWithParams extends LightningElement {
     @api recordId;
     @track article;
     @track error;

     connectedCallback() {
        findArticles({ knowledgerecordid: this.recordId})
            .then(result => {
                this.article= result;
                this.error = undefined;
            .catch(error => {
                this.error = error;
                this.article= undefined;

Check out this:- trailheadapps/lwc-recipes

  • As of 2020-04-14, I can see that KnowledgeArticleVersion is now in that list of supported objects you linked to, but I had no success using lighting-record-view-form or the getRecord method from the uiRecordApi, or any other method suggested for lwc ( developer.salesforce.com/docs/component-library/documentation/…) to get a field from a KnowledgeArticleVersion :( Ended up following your route, using a custom Apex controller (this was with Classic Knowledge, that might have something to do with it)
    – Stephen
    Apr 14, 2020 at 20:54

Try to receive recordId from community component setting like

  <targetConfig targets="lightningCommunity__Default">
      <property name="recordId" type="String" />

And set {!recordId} on it like the standard article detail component. enter image description here

  • Set a default so admins don't need to worry about explicitly setting the {!recordId} string in app builder. E.g. <property name="recordId" type="String" default="{!recordId}" />
    – GeorgeBT
    Sep 6, 2021 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .