Newer Version Available

This content describes an older version of this product. View Latest

PublishingService Class

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

Namespace

KbManagement

Usage

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.

Note

To use the methods in this class, you must enable Salesforce Knowledge. See Salesforce Knowledge Implementation Guide for more information on setting up Salesforce Knowledge.

PublishingService Methods

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.

Signature

public static Void archiveOnlineArticle(String articleId, Datetime scheduledDate)

Parameters

articleId
Type: String
scheduledDate
Type: Datetime

Return Value

Type: Void

Example

assignDraftArticleTask(articleId, assigneeId, instructions, dueDate, sendEmailNotification)

Assigns a review task related to a draft article.

Signature

public static Void assignDraftArticleTask(String articleId, String assigneeId, String instructions, Datetime dueDate, Boolean sendEmailNotification)

Parameters

articleId
Type: String
assigneeId
Type: String
instructions
Type: String
dueDate
Type: Datetime
sendEmailNotification
Type: Boolean

Return Value

Type: Void

Example

assignDraftTranslationTask(articleVersionId, assigneeId, instructions, dueDate, sendEmailNotification)

Assigns a review task related to a draft translation.

Signature

public static Void assignDraftTranslationTask(String articleVersionId, String assigneeId, String instructions, Datetime dueDate, Boolean sendEmailNotification)

Parameters

articleVersionId
Type: String
assigneeId
Type: String
instructions
Type: String
dueDate
Type: Datetime
sendEmailNotification
Type: Boolean

Return Value

Type: Void

Example

cancelScheduledArchivingOfArticle(articleId)

Cancels the scheduled archiving of an online article.

Signature

public static Void cancelScheduledArchivingOfArticle(String articleId)

Parameters

articleId
Type: String

Return Value

Type: Void

Example

cancelScheduledPublicationOfArticle(articleId)

Cancels the scheduled publication of a draft article.

Signature

public static Void cancelScheduledPublicationOfArticle(String articleId)

Parameters

articleId
Type: String

Return Value

Type: Void

Example

completeTranslation(articleVersionId)

Puts a translation in a completed state that is ready to publish.

Signature

public static Void completeTranslation(String articleVersionId)

Parameters

articleVersionId
Type: String

Return Value

Type: Void

Example

deleteArchivedArticle(articleId)

Deletes an archived article.

Signature

public static Void deleteArchivedArticle(String articleId)

Parameters

articleId
Type: String

Return Value

Type: Void

Example

deleteArchivedArticleVersion(articleId, versionNumber)

Deletes a specific archived version of a published article.

Signature

public static Void deleteArchivedArticleVersion(String articleId, Integer versionNumber)

Parameters

articleId
Type: String
versionNumber
Type: Integer

Return Value

Type: Void

Example

deleteDraftArticle(articleId)

Deletes a draft article.

Signature

public static Void deleteDraftArticle(String articleId)

Parameters

articleId
Type: String

Return Value

Type: Void

Example

deleteDraftTranslation(articleVersionId)

Deletes a draft translation.

Signature

public static Void deleteDraftTranslation(String articleVersionId)

Parameters

articleVersionId
Type: String

Return Value

Type: Void

Example

editArchivedArticle(articleId)

Creates a draft article from the archived primary version and returns the new draft primary version ID of the article.

Signature

public static String editArchivedArticle(String articleId)

Parameters

articleId
Type: String

Return Value

Type: String

Example

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.

Signature

public static String editOnlineArticle(String articleId, Boolean unpublish)

Parameters

articleId
Type: String
unpublish
Type: Boolean

Return Value

Type: String

Example

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.

Signature

public static String editPublishedTranslation(String articleId, String language, Boolean unpublish)

Parameters

articleId
Type: String
language
Type: String
unpublish
Type: Boolean

Return Value

Type: String

Example

publishArticle(articleId, flagAsNew)

Publishes an article. If flagAsNew is set to true, the article is published as a major version.

Signature

public static Void publishArticle(String articleId, Boolean flagAsNew)

Parameters

articleId
Type: String
flagAsNew
Type: Boolean

Return Value

Type: Void

Example

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.

Signature

public static String restoreOldVersion(String articleId, Integer versionNumber)

Parameters

articleId
Type: String
versionNumber
Type: Integer

Return Value

Type: String

Example

scheduleForPublication(articleId, scheduledDate)

Schedules the article for publication as a major version. If the specified date is null, the article is published immediately.

Signature

public static Void scheduleForPublication(String articleId, Datetime scheduledDate)

Parameters

articleId
Type: String
scheduledDate
Type: Datetime

Return Value

Type: Void

Example

setTranslationToIncomplete(articleVersionId)

Sets a draft translation that is ready for publication back to “in progress” status.

Signature

public static Void setTranslationToIncomplete(String articleVersionId)

Parameters

articleVersionId
Type: String

Return Value

Type: Void

Example

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.

Signature

public static String submitForTranslation(String articleId, String language, String assigneeId, Datetime dueDate)

Parameters

articleId
Type: String
language
Type: String
assigneeId
Type: String
dueDate
Type: Datetime

Return Value

Type: String

Example