Newer Version Available

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

ArticleType CustomField

Represents the metadata associated with an article type custom field. Use this metadata type to create, update, or delete article type custom field definitions.

This type extends the Metadata metadata type and inherits its fullName field.

Always specify the full name whenever you create or update a custom field. For example, a custom field on a custom object:

1MyArticleType__kav.MyCustomField__c

Declarative Metadata File Suffix and Directory Location

Custom fields are defined as part of the article type. ArticleType field names have a suffix of __c like other custom objects, and must be dot-qualified with the name of the article type to which they belong. See ArticleType for more information.

Retrieving Custom Fields on Custom or Standard Objects

When you retrieve a custom or standard object, you return everything associated with the object. However, you can also retrieve only the custom fields for an object by explicitly naming the object and fields in package.xml. The following definition in package.xml retrieves the files objects/MyCustomObject__c.object, objects/Account.object__c.object, and objects/MyArticleType__kav.object, each containing one custom field definition.

1<types>
2    <members>MyCustomObject__c.MyCustomField__c</members>
3    <members>Account.MyCustomAccountField__c</members>
4    <members>MyArticleType__kav.MyOtherCustomField__c</members>
5    <name>CustomField</name>
6</types>

Version

ArticleTypes custom fields are available in API version 19.0 and later.

Fields for ArticleType

Unless otherwise noted, all fields are createable, filterable, and nillable.

If you create a knowledge validation rule, the errors always display at the top of the page, even if you add it beside the field. Therefore, write the errors descriptively so authors know how to satisfy the validation rule. For example, identify which field is causing the error. The Salesforce Classic user interface does not support field level error messages for articles.

Note

Field Name Field Type Description
defaultValue string If specified, represents the default value of the field.
deleteConstraint DeleteConstraint (enumeration of type string) Provides deletion options for lookup relationships. Valid values are:
SetNull
This is the default. If the lookup record is deleted, the lookup field is cleared.
Restrict
Prevents the record from being deleted if it’s in a lookup relationship.
Cascade
Deletes the lookup record as well as associated lookup fields.

For more information on lookup relationships, see “Object Relationships” in the Salesforce Help.

description string Description of the field.
formula string If specified, represents a formula on the field.
formulaTreatBlankAs TreatBlanksAs (enumeration of type string) Indicates how to treat blanks in a formula. Valid values are BlankAsBlank and BlankAsZero.
fullName string Inherited from Metadata, this field is defined in the WSDL for this metadata type. It must be specified when creating, updating, or deleting. See createMetadata() to see an example of this field specified for a call.

This value cannot be null.

inlineHelpText string Represents the content of field-level help. For more information, see “Define Field-Level Help” in the Salesforce Help.
label string Label for the field. You cannot update the label for standard fields in Article Type such as Title, UrlName, Summary, etc.
length int Length of the field.
picklist Picklist (Including Dependent Picklist) (Deprecated. Use this field in API version 37.0 and earlier only. In later versions, use valueSet instead.) If specified, the field is a picklist, and this field enumerates the picklist values and labels.
referenceTo string If specified, indicates a reference this field has to another object.
relationshipLabel string Label for the relationship.
relationshipName string If specified, indicates the value for one-to-many relationships. For example, in the object MyObject that had a relationship to YourObject, the relationship name might be YourObjects.
required boolean Indicates whether the field requires a value on creation (true) or not (false).
type FieldType Required. Indicates the field type for the field. Valid values are:
  • Checkbox available in version 30.0 and later
  • Currency
  • ArticleCurrency
  • Date
  • DateTime
  • Email
  • File
  • Formula
  • Html
  • Lookup
  • Number
  • Percent
  • Phone
  • Picklist
  • DependentPicklist
  • MultiselectPicklist
  • Text
  • TextArea
  • LongTextArea
  • URL
visibleLines int Indicates the number of lines displayed for the field.

Declarative Metadata Sample Definition

1<?xml version="1.0" encoding="UTF-8"?>
2<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
3    <fields>
4        <fullName>Comments__c</fullName>
5        <description>add your comments about this object here</description>
6        <label>Comments</label>
7        <length>32000</length>
8        <type>LongTextArea</type>
9        <visibleLines>30</visibleLines>
10    </fields>
11</CustomObject>