How to create an article translation via API?

I am having problems to understand how can I create the translated version of an existing article through Apex. I have the KnowledgeArticleId but I don’t know what’s the method to create lets say a ‘french’ version of the master article.

I was trying the following:

//Create a draft from online version
string draftKbId = KbManagement.PublishingService.editOnlineArticle ('kA7W00000004DX8KAM', false);

List<Documentation__kav> KBAtoPublish = new List<Documentation__kav>([Select Id,KnowledgeArticleId, TopicId__c, Title, UrlName, content__c from Documentation__kav
                  WHERE Id=: draftKbId]);

//Modify Draft values

KBAtoPublish[0].Content__c='le content';
KBAtoPublish[0].Title='french version';
KBAtoPublish[0].UrlName='frenchURL-example';
KBAtoPublish[0].Language='fr';

Update KBAtoPublish[0];

I get the message “Language is not writeable”

Any help will be appreciated!

Answer

Alright, so the solution is to use the method to create a new draft translation which then can be modified and set as completed.

string DraftTranslation= KbManagement.PublishingService.submitForTranslation(masterArticleId, language, assigneeId, dueDate);

Attribution
Source : Link , Question Author : PepeFloyd , Answer Author : PepeFloyd

Leave a Comment