You need to sign in to do that
Don't have an account?
Scott McArthur 8
Fields on Knowledge Article Not Displayed On Lightning Component
I have a Lightning component to display a list of Knowledge Articles. The code runs ok and seems to enter the `<aura:iteration` as the colons are displayed and looking at the debug log the query is returning results however the fields themselves like Title are not displayed when I run this in developer console.
component
controller
apex controller
component
<aura:component description="ArticleList" implements="forceCommunity:availableForAllPageTypes" controller="ArticleListController"> <aura:attribute name="articles" type="SObject[]"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <aura:iteration var="article" items="{!v.articles}"> <p>{!article.Id} : {!article.Title} : {!article.ArticleType}</p> </aura:iteration> </aura:component>
controller
({ doInit: function(component, event){ var action = component.get("c.getArticles"); action.setCallback(this, function(response){ component.set("v.articles", response.getReturnValue()); }); $A.enqueueAction(action); } })
apex controller
public with sharing class ArticleListController { @AuraEnabled public static List<List<SObject>> getArticles() { String searchVar = 'Unpredictable'; List<List<SObject>> articles = [FIND :searchVar RETURNING KnowledgeArticleVersion (Id, Title, ArticleType WHERE PublishStatus='online' AND Language = 'en_US' AND ArticleType IN ('Knowledge__kav','Attachment__kav'))]; return articles; } }
For this, I am currently using the <ui:outputURL label="Attachment" value="{!v.articleDetail.Id}"/> and here I am able to get the article id under the label "Attacment" but from here, I am not able to identify how to get the attachment open/ download in community.