+ Start a Discussion

SOQL on CaseArticle (case -> knowledge link) not fetching relationship constructs?

I have a Case that SFDC Support has been working on for a while on this, but thought I'd throw it out here to see if anybody has run into something similar.


We are using SOQL to fetch a count of all Case Ids (unique) that have Knowledge Article linked via OOB SFDC functionality, but grouped by whomever created the article:


Select COUNT_DISTINCT(Case.Id), c.KnowledgeArticle.CreatedById From CaseArticle c where c.Case.isClosed = true group by c.KnowledgeArticle.CreatedById Limit 10000 


Curiously, we are seeing this return a grouping in debug logs like so, where it implies there are linked knowledge articles that were created by nobody:


AggregateResult:{expr0=12, CreatedById=null} 


Of course, we've run through the standard troubleshooting steps of trying different API versions, trying it in System Log, etc with the same results. Also, if we directly select all Knowledge Articles, there are none that have a CreatedById == null. Curious. What's more odd is that certain pods/orgs may also behave differently. We have an org on na8 where we only get back results like above (selecting knowledge articles via CaseArticle object always gives createdbyid == null). Other orgs on na3 return a few groupings that are correct, but still have a handful of linked articles that look like CreatedById == null.


Anybody else feel my pain out there?