KnowledgeArticleVersionStandardController Class
KnowledgeArticleVersionStandardController objects offer article-specific functionality in addition to what is provided by the StandardController.
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.
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:
- Create an article type called
FAQ. For instructions, see “Create Article Types” in the Salesforce online help. - Create a text custom field called
Details. For instructions, see “Add Custom Fields to Article Types” in the Salesforce online help. - Create a category group called
Geographyand assign it to a category calledUSA. For instructions, see “Create and Modify Category Groups” and “Add Data Categories to Category Groups” in the Salesforce online help. - Create a category group called
Topicsand assign it a category calledMaintenance.
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:
- Log into your Salesforce organization and from Setup, enter
Knowledge Settingsin theQuick Findbox, then select Knowledge Settings. - Click Edit.
- Assign the class to the
Use Apex customizationfield. This associates the article type specified in the new class with the article type assigned to closed cases. - Click Save.
See Also
The following are constructors for KnowledgeArticleVersionStandardController.
-
KnowledgeArticleVersionStandardController(article)
Creates a new instance of the
ApexPages.KnowledgeArticleVersionStandardControllerclass using the specified knowledge article.
Creates a new instance of the ApexPages.KnowledgeArticleVersionStandardController class using the specified knowledge article.
public KnowledgeArticleVersionStandardController(SObject article)
- article: Type: SObject The knowledge article, such as
FAQ_kav.
The following are instance methods for KnowledgeArticleVersionStandardController.
-
Returns the ID for the source object record when creating a new article from another object.
-
setDataCategory(categoryGroup, category)
Specifies a default data category for the specified data category group when creating a new article.
Returns the ID for the source object record when creating a new article from another object.
public String getSourceId()
Type: String
Specifies a default data category for the specified data category group when creating a new article.
public Void setDataCategory(String categoryGroup, String category)
Type: Void