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.Content__c='le content'; KBAtoPublish.Title='french version'; KBAtoPublish.UrlName='frenchURL-example'; KBAtoPublish.Language='fr'; Update KBAtoPublish;
I get the message “Language is not writeable”
Any help will be appreciated!
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);