PublishingService Class

Use the methods in the KbManagement.PublishingService class to manage the lifecycle of an article and its translations.

KbManagement

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.

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)

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)

Type: Void

Cancels the scheduled archiving of an online article.

public static Void cancelScheduledArchivingOfArticle(String articleId)

Type: Void

Cancels the scheduled publication of a draft article.

public static Void cancelScheduledPublicationOfArticle(String articleId)

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)

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)

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)

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