Newer Version Available

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

KnowledgeArticleVersionStandardController Class

KnowledgeArticleVersionStandardController objects offer article-specific functionality in addition to what is provided by the StandardController.

Namespace

ApexPages

Usage

In addition to the method listed above, the KnowledgeArticleVersionStandardController class inherits all the methods associated with StandardController.

Though inherited, the edit, delete, and save methods don't serve a function when used with the KnowledgeArticleVersionStandardController class.

Note

Example

The following example shows how a KnowledgeArticleVersionStandardController object can be used to create a custom extension controller. In this example, you create a class named AgentContributionArticleController that allows customer-support agents to see pre-populated fields on the draft articles they create while closing cases.

Prerequisites:
  1. Create an article type called FAQ. For instructions, see “Create Article Types” in the Salesforce online help.
  2. Create a text custom field called Details. For instructions, see “Add Custom Fields to Article Types” in the Salesforce online help.
  3. Create a category group called Geography and assign it to a category called USA. For instructions, see “Create and Modify Category Groups” and “Add Data Categories to Category Groups” in the Salesforce online help.
  4. Create a category group called Topics and assign it a category called Maintenance.
If you created the custom extension controller for the purpose described in the previous example (that is, to modify submitted-via-case articles), complete the following steps after creating the class:
  1. Log into your Salesforce organization and from Setup, enter Knowledge Settings in the Quick Find box, then select Knowledge Settings.
  2. Click Edit.
  3. Assign the class to the Use Apex customization field. This associates the article type specified in the new class with the article type assigned to closed cases.
  4. Click Save.

KnowledgeArticleVersionStandardController Constructors

The following are constructors for KnowledgeArticleVersionStandardController.

KnowledgeArticleVersionStandardController(article)

Creates a new instance of the ApexPages.KnowledgeArticleVersionStandardController class using the specified knowledge article.

Signature

public KnowledgeArticleVersionStandardController(SObject article)

Parameters

article
Type: SObject
The knowledge article, such as FAQ_kav.

KnowledgeArticleVersionStandardController Methods

The following are instance methods for KnowledgeArticleVersionStandardController.

getSourceId()

Returns the ID for the source object record when creating a new article from another object.

Signature

public String getSourceId()

Return Value

Type: String

setDataCategory(categoryGroup, category)

Specifies a default data category for the specified data category group when creating a new article.

Signature

public Void setDataCategory(String categoryGroup, String category)

Parameters

categoryGroup
Type: String
category
Type: String

Return Value

Type: Void