function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC_LearnerSFDC_Learner 

Reg: Knowledge article version

Hi,

 

While working with KAV with the below query i got an error.

 

Can you please suggest me. How can i overcome this.

 

This is my query:

=================

List<knowledgearticleversion> lstKAV = new List<Knowledgearticleversion>();
lstKAV = [SELECT Title, Summary , PublishStatus
FROM KnowledgeArticleVersion
WHERE (PublishStatus='Online' OR PublishStatus='Draft' OR PublishStatus='Archieved')
AND Language = 'en_US'];

system.debug('****Lst of KAVS are ***'+lstKAV);

------------------------------------

Using the above i have to retrieve all Online, Draft and Archied articles.

 

 

My Error is :

=========

line 2, column 10: Implementation restriction: When querying or searching the KnowledgeArticleVersion 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.

 

 

 

 

francoisLfrancoisL

You can query only one PublishStatus at a time. 

SFDC_LearnerSFDC_Learner

Hi,

 

Can u plz give the solution to the following questions.

 

1. Can we insert multiple Knowledge articles at a time using either salesforce customization or coding from system log or from apex class?

 

2. If it is possible list of articles insertion at a time, then how can i relate these articles to a particular case? While inserting any articlefrom system log it shows all fields which are in article is not writable? so as per my understanding, its not possible to insert bulkarticles or a single article from any apex code? is my understading correct?

 

3. To relate the articles to a case, i went through case related list -> articles section -> clicked on new button -> then i chosen anarticle type .................then i created a new article. Now this article created from case related list  is related to that particular case. But while going with any dataloader or any list insertion from code how can we related all the list of articles to case? here i can able to see  sourceid field on article, but its not useful to enter case id. Because all fields which are from articles object are not writable.? 

 

 Please give your valuable reply.

 

 

Thanks
francoisLfrancoisL

Hi,

 

1. You can use the API (Apex or SOAP) to create articles, you can also use the bulk API.

 

2. If you want to link an article to a case, you need to create a record on this object CaseArticle. CaseArticle is used to create the link between case and articles.

 

3. Use CaseArticle.

SFDC_LearnerSFDC_Learner

Hi Francoisl,

 

Thanks for your valueable reply.

 

 

Can you please give me a sample snippet or any URL to get the guidance for this?

 

 

SFDC_LearnerSFDC_Learner

Hi,

 

but when i enable the knowledge base, i did not get CaseArticles Object.

What are the required setps to enable this object?

Can you give the any API url to work on it?

 

 

SFDC_LearnerSFDC_Learner

HI,

 

I have created some articles from articles tab. Initially which are related to any case.

 

When i go with Case relatedlist -> Articles -> clicked on Find articles -> and i attached any of existing articles to case.

 

Now these i can see these articles in my case relatedlist to that particular case.

 

But when i am querying the articles based on this case id, i am getting null. It means these articles are not binded to Case id. 

 

Can you please suggest me, how can i attach the existing articles to my case?

 

 

francoisLfrancoisL

To attach an article to a case, you just need to create a new record of CaseArticle and specifying the requested field like:

    CaseArticle ca = new CaseArticle();
    ca.CaseID = caseID;
    ca.KnowledgeArticleId = kaID;

    insert ca;

 

 

You can also add the language and the version number.

Harika ZillaHarika Zilla

Hi,

 

Iam trying to create an article from apex code and when i try to assign case id value to sourceId,iam getting the following error:

"Unable to create/update fields: SourceId".

 

Please provide the solution how to assign a value to sourceId field for articles.

 

Thank you,

Harika.

francoisLfrancoisL

SourceId is not a createable field:

 

SourceId

  • autoNumber: false
  • byteLength: 18
  • calculated: false
  • caseSensitive: false
  • createable: false
  • custom: false
  • defaultedOnCreate: false
  • deprecatedAndHidden: false
  • digits: 0
  • filterable: true
  • groupable: true
  • idLookup: false
  • label: Source
  • length: 18
  • name: SourceId
  • nameField: false
  • namePointing: false
  • nillable: true
  • permissionable: false
  • precision: 0
  • restrictedPicklist: false
  • scale: 0
  • soapType: tns:ID
  • sortable: true
  • type: reference
  • unique: false
  • updateable: false
Harika ZillaHarika Zilla

Hi francoisL,

 

Thanks for your reply.

 

Is there any workaround to create a KnowledgeArticleVersion with "SourceId" contains case id.

 

Thanks,

Harika.

francoisLfrancoisL

From API standpoint, today, there is no workaround.

 

But, if you use the out of the box feature (create article from a case), we are populating this field automatically.

Harika ZillaHarika Zilla

Hi francoisl,

 

Thanks for your reply.

 

Thank you,

Harika.