PublishingService Class
Use the methods in the KbManagement.PublishingService class to manage the lifecycle of an article and its translations.
Use the methods in the KbManagement.PublishingService class to manage the following parts of the lifecycle of an article and its translations:
- Publishing
- Updating
- Retrieving
- Deleting
- Submitting for translation
- Setting a translation to complete or incomplete status
- Archiving
- Assigning review tasks for draft articles or translations
Date values are based on GMT.
To use the methods in this class, you must enable Salesforce Knowledge.
The following are methods for PublishingService. All methods are static.
-
archiveOnlineArticle(articleId, scheduledDate)
Archives an online version of an article. If the specified scheduledDate is null, the article is archived immediately. Otherwise, it archives the article on the scheduled date.
-
assignDraftArticleTask(articleId, assigneeId, instructions, dueDate, sendEmailNotification)
Assigns a review task related to a draft article.
-
Assigns a review task related to a draft translation.
-
cancelScheduledArchivingOfArticle(articleId)
Cancels the scheduled archiving of an online article.
-
cancelScheduledPublicationOfArticle(articleId)
Cancels the scheduled publication of a draft article.
-
completeTranslation(articleVersionId)
Puts a translation in a completed state that is ready to publish.
-
deleteArchivedArticle(articleId)
Deletes an archived article.
-
deleteArchivedArticleVersion(articleId, versionNumber)
Deletes a specific archived version of a published article.
-
Deletes a draft article.
-
deleteDraftTranslation(articleVersionId)
Deletes a draft translation.
-
editArchivedArticle(articleId)
Creates a draft article from the archived primary version and returns the new draft primary version ID of the article.
-
editOnlineArticle(articleId, unpublish)
Creates a draft article from the online version and returns the new draft primary version ID of the article. Also, unpublishes the online article, if unpublish is set to
true. -
editPublishedTranslation(articleId, language, unpublish)
Creates a draft version of the online translation for a specific language and returns the new draft primary version ID of the article. Also, unpublishes the article, if set to
true. -
publishArticle(articleId, flagAsNew)
Publishes an article. If flagAsNew is set to
true, the article is published as a major version. -
restoreOldVersion(articleId, versionNumber)
Creates a draft article from an existing online article based on the specified archived version of the article and returns the article version ID.
-
scheduleForPublication(articleId, scheduledDate)
Schedules the article for publication as a major version. If the specified date is null, the article is published immediately.
-
setTranslationToIncomplete(articleVersionId)
Sets a draft translation that is ready for publication back to “in progress” status.
-
submitForTranslation(articleId, language, assigneeId, dueDate)
Submits an article for translation to the specified language. Also assigns the specified user and due date to the submittal and returns new ID of the draft translation.
Archives an online version of an article. If the specified scheduledDate is null, the article is archived immediately. Otherwise, it archives the article on the scheduled date.
public static Void archiveOnlineArticle(String articleId, Datetime scheduledDate)
Type: Void
Assigns a review task related to a draft article.
public static Void assignDraftArticleTask(String articleId, String assigneeId, String instructions, Datetime dueDate, Boolean sendEmailNotification)
-
articleId:
Type: String
-
assigneeId:
Type: String
-
instructions:
Type: String
-
dueDate:
Type: Datetime
-
sendEmailNotification:
Type: Boolean
Type: Void
Assigns a review task related to a draft translation.
public static Void assignDraftTranslationTask(String articleVersionId, String assigneeId, String instructions, Datetime dueDate, Boolean sendEmailNotification)
-
articleVersionId:
Type: String
-
assigneeId:
Type: String
-
instructions:
Type: String
-
dueDate:
Type: Datetime
-
sendEmailNotification:
Type: Boolean
Type: Void
Cancels the scheduled archiving of an online article.
public static Void cancelScheduledArchivingOfArticle(String articleId)
-
articleId:
Type: String
Type: Void
Cancels the scheduled publication of a draft article.
public static Void cancelScheduledPublicationOfArticle(String articleId)
-
articleId:
Type: String
Type: Void
Puts a translation in a completed state that is ready to publish.
public static Void completeTranslation(String articleVersionId)
-
articleVersionId:
Type: String
Type: Void
Deletes an archived article.
public static Void deleteArchivedArticle(String articleId)
-
articleId:
Type: String
Type: Void
Deletes a specific archived version of a published article.
public static Void deleteArchivedArticleVersion(String articleId, Integer versionNumber)
Type: Void
Deletes a draft article.
public static Void deleteDraftArticle(String articleId)
-
articleId:
Type: String
Type: Void
Deletes a draft translation.
public static Void deleteDraftTranslation(String articleVersionId)
-
articleVersionId:
Type: String
Type: Void
Creates a draft article from the archived primary version and returns the new draft primary version ID of the article.
public static String editArchivedArticle(String articleId)
-
articleId:
Type: String
Type: String
Creates a draft article from the online version and returns the new draft primary version ID of the article. Also, unpublishes the online article, if unpublish is set to true.
public static String editOnlineArticle(String articleId, Boolean unpublish)
Type: String
Creates a draft version of the online translation for a specific language and returns the new draft primary version ID of the article. Also, unpublishes the article, if set to true.
public static String editPublishedTranslation(String articleId, String language, Boolean unpublish)
Type: String
Publishes an article. If flagAsNew is set to true, the article is published as a major version.
public static Void publishArticle(String articleId, Boolean flagAsNew)
Type: Void
Creates a draft article from an existing online article based on the specified archived version of the article and returns the article version ID.
public static String restoreOldVersion(String articleId, Integer versionNumber)
Type: String
Schedules the article for publication as a major version. If the specified date is null, the article is published immediately.
public static Void scheduleForPublication(String articleId, Datetime scheduledDate)
Type: Void
Sets a draft translation that is ready for publication back to “in progress” status.
public static Void setTranslationToIncomplete(String articleVersionId)
-
articleVersionId:
Type: String
Type: Void
Submits an article for translation to the specified language. Also assigns the specified user and due date to the submittal and returns new ID of the draft translation.
public static String submitForTranslation(String articleId, String language, String assigneeId, Datetime dueDate)
Type: String