You need to sign in to do that
Don't have an account?
S91084
Help on Filtering Knowledge Articles based on the custom multi-select picklist values
Hi,
I am trying to display the articles based on the product selected by the user that matches the software on the article.
Below is my code. I have articles that match the below criteria but not able to get the results. It is returning 0 rows.
public List<KnowledgeArticleVersion> getArticles(){ User u = [Select Id, Product__c, Industry__c from User where Id=:userinfo.getUserId()]; String[] Product = u.Product__c.split(';'); List<Problem__Kav> problems = [Select Id,KnowledgeArticleId,Software__c from Problem__Kav where Software__C IN :Product and PublishStatus='Online' and Language='en_US']; if(!problems.isEmpty()){ for(Problem__Kav p : problems) articleIds.add(p.KnowledgeArticleId); } List<KnowledgeArticleVersion> technicalarticles=[Select ArticleNumber, UrlName, Title,KnowledgeArticleId, CreatedDate, CreatedById From KnowledgeArticleVersion where PublishStatus='Online' and Language='en_US'and KnowledgeArticleId IN :articleIds order by LastPublishedDate desc]; return technicalarticles; }
Can anyone please help me on this.
If i am removing the filter Software__c IN :Product, I am getting the results.
I figured it out. Below is the updated code.
All Answers
Have you tried this? The system.debug lines should help you see whether Product contains what you expect.
I figured it out. Below is the updated code.