1

I have an article type "Lesson" that has a lookup relationship with an object "Chapter". I want to do a SOQL query (via REST API) to get all Lessons that are in a list of Chapters. It looks like this:

SELECT Title, UrlName FROM Lesson__kav WHERE Chapter__r.Id IN ( 'a036100000CCS8jAAH', 'a036100000CCS9sAAH')

However, I am getting this error:

MALFORMED_QUERY: Implementation restriction: When querying or searching the Lesson__kav object, you must filter using the following syntax: Id = [single ID], Id IN [list of ID's] or PublishStatus = [status]. In addition PublishStatus is only permitted in a top-level AND condition.

When I try square brackets instead of parentheses:

SELECT Title, UrlName FROM Lesson__kav WHERE Chapter__r.Id IN [ 'a036100000CCS8jAAH', 'a036100000CCS9sAAH']

I get:

MALFORMED_QUERY: Lesson__kav WHERE Chapter__r.Id IN [ 'a036100000CCS8jAAH', 'a036100000CCS9sAAH'] ^ ERROR at Row:1:Column:60 Bind variables only allowed in Apex code

I can't quite figure out if I'm having a format issue or if this is something I simply cannot do outside of Apex code.

3

If you check out the salesforce documentation you must:

When ObjectTypeName equals to KnowledgeArticleVersion or any article type API Name in the FROM clause, a WHERE clause must be specified with one of the following parameters:

  • PublishStatus to query articles depending on their status in the publishing cycle:

    • WHERE PublishStatus='online' for published articles
    • WHERE PublishStatus='archived' for archived articles
    • WHERE PublishStatus='draft' for draft articles
  • Id to query an article based on its id

Example

SELECT Id, Title
FROM Offer__kav
WHERE PublishStatus='Draft'
AND Language = 'en_US'
WITH DATA CATEGORY Geography__c AT (france__c,usa__c) AND Product__c ABOVE dsl__c
  • I tried PublishStatus='Online' and got the same Bind variable error: I decided to just try querying using the format you provided. Error: MALFORMED_QUERY: Implementation restriction: When querying the Lesson__kav object, you must filter using the following syntax: Id = [single ID], Id IN [list of ID's] or Language = [language ISO code]. In addition Language is only permitted in a top-level AND condition. – Fabio DeSousa Aug 25 '16 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.