Generate a fresh article.
Knowledge__kav ka = new Knowledge__kav(); ka.Title = 'Salesforce CRM'; ka.UrlName = 'salesforce-crm'; ka.Summary = 'Salesforce Cloud CRM'; ka.Language = 'en_US'; insert ka;
Release a draft article.
String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.publishArticle(knowledgeArticleId, true);
Withdraw a published article.
String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.publishArticle(knowledgeArticleId, true);
Arrange the archival of a published article.
String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id Datetime scheduledDate = System.now().addMonths(2); //Add date to schedule the archive KbManagement.PublishingService.archiveOnlineArticle(knowledgeArticleId, scheduledDate);
Please note that if the scheduledDate provided is null, the article will be archived immediately.
Revoke the scheduled archival of a published article:
String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.cancelScheduledArchivingOfArticle(knowledgeArticleId);
Remove an article from the archive:
String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.deleteArchivedArticle(knowledgeArticleId);
Erase a draft article:
String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.deleteDraftArticle(knowledgeArticleId);
Generate a draft article based on the archived article.
String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.editArchivedArticle(knowledgeArticleId);
Take down a published article to draft:
String knowledgeArticleId = 'kA06g000002AJ7t'; //Add knowledge article record id KbManagement.PublishingService.editOnlineArticle(knowledgeArticleId, true);