You need to sign in to do that
Don't have an account?
Sanjay Wadge
Need a queyr to get list of Knowledge Article Numbers associated to a case
Hi,
I am trying to write a apex code to get the list of Knowledge Articles associated to a cases. I am particularly interested in ArticleNumber from Knowedge Articles. We have CaseArticle object (middle object in M2M relationship) which stores both, CaseId and KnowledgeArticleId. Using KnowledgeArticleId, I want to get Aritcle Numbers stored in KnowledgeArticle. Struggle I am having is wrining joined query. I can query one by one object starting with Case Id, then getting KnowledgeArticleId and then getting ArticleNumber. But this is not efficient way of doing as I need to loop through multiple cases (say for cases created in last one month). Also, not sure what is relationship names as API doc does not give the details as well as these objects are not visible in salesforce setup (except case object). Please advise.
I am trying to write a apex code to get the list of Knowledge Articles associated to a cases. I am particularly interested in ArticleNumber from Knowedge Articles. We have CaseArticle object (middle object in M2M relationship) which stores both, CaseId and KnowledgeArticleId. Using KnowledgeArticleId, I want to get Aritcle Numbers stored in KnowledgeArticle. Struggle I am having is wrining joined query. I can query one by one object starting with Case Id, then getting KnowledgeArticleId and then getting ArticleNumber. But this is not efficient way of doing as I need to loop through multiple cases (say for cases created in last one month). Also, not sure what is relationship names as API doc does not give the details as well as these objects are not visible in salesforce setup (except case object). Please advise.
There is one object call KnowledgeArticleVersion which contains one field called sourceid(case or reply). I think you can query that object as shown below to get your data.
Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.