list<string> setknowledgeArticleIds = new list<string>(); setknowledgeArticleIds.addAll(knowledgeArticleIdToHS_Sync.keySet()); knowledgeQuery = 'SELECT Id ,KnowledgeArticleId , ' + title + ',' + answer + ' FROM ' + articleType; knowledgeQuery += ' WHERE PublishStatus = \'Online\' AND language = \'en_US\' AND KnowledgeArticleId IN :setknowledgeArticleIds ';
throwing an error : System.QueryException: Variable does not exist:
In debug log i can see the query as :
SELECT Id ,KnowledgeArticleId , title,summary FROM hsinhouse__test_article_type_2__kav WHERE PublishStatus = 'Online' AND language = 'en_US' AND KnowledgeArticleId IN :setknowledgeArticleIds
Its a strange error . Please let me know if you find solution
Is it a typo* that you typed aphostphe after the setknowledgeArticleIds variable in the last line, And Please let us know where are you trying to run this code.
If setknowledgeArticleIds is a list of ID's you can declare it as
SET<ID> setknowledgeArticleIdsinstead of a