+ Start a Discussion
LukashPLukashP 

[Knowledge] Querying for article by external id

The system we have gets articles from an external system. The articles have to be sometimes identified between those 2 systems. This external identifier has to come from the other system, not Salesforce. Since there is no notion of "unique" field on article type, we decided to store it on UrlName for that (but the question would not really change if it was another field).

So now, when our webservice is called and we want to know if we have this article in our knowledge base. We get the external id from the call and now we want to check if this article is in our database. Here is where it gets very tricky.
We cannot write a SOQL query like:
SELECT Id FROM FAQ__kav Where UrlName = 'asda'
because we would get an error that you have to query using publishStatus and language. That's understandable but there are 3 statuses and our organization have already 24 languagues enabled. So to check to be really really sure if this article is in our knowledge base we would have to do 3*24 = 72 queries? That seems pretty crazy.

What are we doing wrong, how could it be done differently ?

jhurstjhurst

LukashP,


Unfortunatelt, you are not doing anything wrong.  When querying for Articles, you would have to do the query as you describe (adding filters for language and publishStatus.


There are a couple of options:

 

1. Since you are trying to find an article based on the article in your system, you may be able to tell what the language of the article.  This would reduce the number of queries to a max of 3 (one query for each status).

 

2. You coul dbuild a custom table that you can use to store the Article data.  You coul dthen run queries agains this table.  The issue here is taht you would have to find ways to keep the Article Table and the custom table in sync.

 

Hope this helps.

Jay