Column Class

Describes a column on a DataSource.Table. This class extends the DataSourceUtil class and inherits its methods.

DataSource

A list of column metadata is provided by the DataSource.Connection class when the sync() method is invoked. Each column can become a field on an external object.

The metadata is stored in Salesforce. Updating the Apex code to return new or updated values for the column metadata doesn’t automatically update the stored metadata in Salesforce.

The following are properties for Column.

  • decimalPlaces

    If the data type is numeric, the number of decimal places to the right of the decimal point.

  • description

    Description of what the column represents.

  • filterable

    Whether a result set can be filtered based on the values of the column.

  • isPicklistAlphabeticallySorted

    Returns true if the picklist is sorted alphabetically, false otherwise.

  • isPicklistRestricted

    Returns true if the picklist is restricted, false otherwise.

  • label

    User-friendly name for the column that appears in the Salesforce user interface.

  • length

    If the column is a string data type, the number of characters in the column. If the column is a numeric data type, the total number of digits on both sides of the decimal point, but excluding the decimal point.

  • name

    Name of the column in the external system.

  • picklistValues

    If the data type is a picklist, the picklist values.

  • referenceTargetField

    API name of the custom field on the parent object whose values are compared against this column’s values. Matching values identify related records in an indirect lookup relationship. Applies only when the column’s data type is INDIRECT_LOOKUP_TYPE. For other data types, this value is ignored.

  • referenceTo

    API name of the parent object in the relationship that’s represented by this column. Applies only when the column’s data type is LOOKUP_TYPE, EXTERNAL_LOOKUP_TYPE, or INDIRECT_LOOKUP_TYPE. For other data types, this value is ignored.

  • sortable

    Whether a result set can be sorted based on the values of the column via an ORDER BY clause.

  • type

    Data type of the column.

If the data type is numeric, the number of decimal places to the right of the decimal point.

public Integer decimalPlaces {get; set;}

Type: Integer

Description of what the column represents.

public String description {get; set;}

Type: String

Whether a result set can be filtered based on the values of the column.

public Boolean filterable {get; set;}

Type: Boolean

Returns true if the picklist is sorted alphabetically, false otherwise.

public Boolean isPicklistAlphabeticallySorted {get; set;}

Type: Boolean

Returns true if the picklist is restricted, false otherwise.

public Boolean isPicklistRestricted {get; set;}

Type: Boolean

User-friendly name for the column that appears in the Salesforce user interface.

public String label {get; set;}

Type: String

If the column is a string data type, the number of characters in the column. If the column is a numeric data type, the total number of digits on both sides of the decimal point, but excluding the decimal point.

public Integer length {get; set;}

Type: Integer

Name of the column in the external system.

public String name {get; set;}

Type: String

If the data type is a picklist, the picklist values.

public List<Map<String,String>> picklistValues {get; set;}

Type: List<Map<String,String>>

API name of the custom field on the parent object whose values are compared against this column’s values. Matching values identify related records in an indirect lookup relationship. Applies only when the column’s data type is INDIRECT_LOOKUP_TYPE. For other data types, this value is ignored.

public String referenceTargetField {get; set;}

Type: String

API name of the parent object in the relationship that’s represented by this column. Applies only when the column’s data type is LOOKUP_TYPE, EXTERNAL_LOOKUP_TYPE, or INDIRECT_LOOKUP_TYPE. For other data types, this value is ignored.

public String referenceTo {get; set;}

Type: String

Whether a result set can be sorted based on the values of the column via an ORDER BY clause.

public Boolean sortable {get; set;}

Type: Boolean

Data type of the column.

public DataSource.DataType type {get; set;}

Type: DataSource.DataType

The following are methods for Column.

Returns a new column of data type BOOLEAN_TYPE.

public static DataSource.Column boolean(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

Returns a new column of data type CURRENCY_TYPE.

public static DataSource.Column currency(String name, Integer length, Integer decimalPlaces)

  • name:

    Type: String

    Name of the column.

  • length:

    Type: Integer

    Number of characters allowed in the column.

  • decimalPlaces:

    Type: Integer

    Number of decimal places to the right of the decimal point.

Type: DataSource.Column

Returns a new column of data type DATE_TYPE.

public static DataSource.Column date(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

Returns a new column of data type DATETIME_TYPE.

public static DataSource.Column datetime(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

Returns a new column of data type EMAIL_TYPE.

public static DataSource.Column email(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

Returns a new column of data type EXTERNAL_LOOKUP_TYPE.

public static DataSource.Column externalLookup(String name, String domain)

  • name:

    Type: String

    Name of the column.

  • domain:

    Type: String

    API

    name of the parent object in the external lookup relationship.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.EXTERNAL_LOOKUP_TYPE
length255
decimalPlaces0
referenceTodomain
referenceTargetFieldnull

Returns a new column with the 13 specified Column property values.

public static DataSource.Column get(String name, String label, String description, Boolean isSortable, Boolean isFilterable, DataSource.DataType type, Integer length, Integer decimalPlaces, String referenceTo, String referenceTargetField, Object picklistValuesObj, Boolean isPicklistAlphabeticallySorted, Boolean isPicklistRestricted)

See Column Properties for information about each parameter.

Type: DataSource.Column

Returns a new column with the ten specified Column property values.

public static DataSource.Column get(String name, String label, String description, Boolean isSortable, Boolean isFilterable, DataSource.DataType type, Integer length, Integer decimalPlaces, String referenceTo, String referenceTargetField)

See Column Properties for information about each parameter.

Type: DataSource.Column

Returns a new column with the eight specified Column property values.

public static DataSource.Column get(String name, String label, String description, Boolean isSortable, Boolean isFilterable, DataSource.DataType type, Integer length, Integer decimalPlaces)

See Column Properties for information about each parameter.

Type: DataSource.Column

Returns a new column with the seven specified Column property values.

public static DataSource.Column get(String name, String label, String description, Boolean isSortable, Boolean isFilterable, DataSource.DataType type, Integer length)

See Column Properties for information about each parameter.

Type: DataSource.Column

Returns a new column of data type INDIRECT_LOOKUP_TYPE.

public static DataSource.Column indirectLookup(String name, String domain, String targetField)

  • name:

    Type: String

    Name of the column.

  • domain:

    Type: String

    API

    name of the parent object in the indirect lookup relationship.

  • targetField:

    Type: String

    API

    name of the custom field on the parent object whose values are compared against this column’s values. Matching values identify related records in an indirect lookup relationship.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.INDIRECT_LOOKUP_TYPE
length255
decimalPlaces0
referenceTodomain
referenceTargetFieldtargetField

Returns a new numeric column with no decimal places using the specified name and length.

public static DataSource.Column integer(String name, Integer length)

  • name:

    Type: String

    The column name.

  • length:

    Type: Integer

    The column length.

Type: DataSource.Column

Returns a new column of data type LOOKUP_TYPE.

public static DataSource.Column lookup(String name, String domain)

  • name:

    Type: String

    Name of the column.

  • domain:

    Type: String

    API

    name of the parent object in the lookup relationship.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.LOOKUP_TYPE
length255
decimalPlaces0
referenceTodomain
referenceTargetFieldnull

Returns a new column of data type PICKLIST_MULTISELECT_TYPE with the specified name and picklist values. You can also specify whether the picklist is sorted alphabetically or if the picklist is restricted.

public static DataSource.Column multipicklist(String name, List<Map<String,String>> picklistValues, Boolean isPicklistAlphabeticallySorted, Boolean isPicklistRestricted)

  • name:

    Type: String

    Name of the column.

  • picklistValues:

    Type: List<Map<String,String>>

  • isPicklistAlphabeticallySorted: Indicates whether the picklist is sorted alphabetically.

  • isPicklistRestricted:

    Type: Boolean

    Indicates whether the picklist is restricted.

Type: DataSource.Column

Returns a new column of data type PICKLIST_MULTISELECT_TYPE with the specified name and picklist values.

public static DataSource.Column multipicklist(String name, List<Map<String,String>> picklistValues)

  • name:

    Type: String

    Name of the column.

  • picklistValues:

    Type: List<Map<String,String>>

    List of picklist values.

Type: DataSource.Column

Returns a new column of data type NUMBER_TYPE.

public static DataSource.Column number(String name, Integer length, Integer decimalPlaces)

See Column Properties for information about each parameter.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.NUMBER_TYPE
lengthlength
decimalPlacesdecimalPlaces

Returns a new column of data type PERCENT_TYPE.

public static DataSource.Column percent(String name, Integer length, Integer decimalPlaces)

  • name:

    Type: String

    Name of the column.

  • length:

    Type: Integer

    Number of characters allowed in the column.

  • decimalPlaces:

    Type: Integer

    Number of decimal places to the right of the decimal point.

Type: DataSource.Column

Returns a new column of data type PHONE_TYPE.

public static DataSource.Column phone(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

Returns a new column of data type PICKLIST_TYPE with the specified name and picklist values. You can also specify whether the picklist is sorted alphabetically or if the picklist is restricted.

public static DataSource.Column picklist(String name, List<Map<String,String>> picklistValues, Boolean isPicklistAlphabeticallySorted, Boolean isPicklistRestricted)

  • name:

    Type: String

    Name of the column.

  • picklistValues:

    Type: List<Map<String,String>>

    List of picklist values.

  • isPicklistAlphabeticallySorted: Indicates whether the picklist is sorted alphabetically.

  • isPicklistRestricted:

    Type: Boolean

    Indicates whether the picklist is restricted.

Type: DataSource.Column

Returns a new column of data type PICKLIST_TYPE with the specified name and picklist values.

public static DataSource.Column picklist(String name, List<Map<String,String>> picklistValues)

  • name:

    Type: String

    Name of the column.

  • picklistValues:

    Type: List<Map<String,String>>

    List of picklist values.

Type: DataSource.Column

Returns a new column of data type STRING_SHORT_TYPE or STRING_LONG_TYPE, with the specified name, label, and length.

public static DataSource.Column text(String name, String label, Integer length)

  • name:

    Type: String

    Name of the column.

  • label:

    Type: String

    User-friendly name

    for the column that appears in the Salesforce user interface.

  • length:

    Type: Integer

    Number of characters allowed in the column.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labellabel
descriptionlabel
isSortabletrue
isFilterabletrue
typeDataSource.DataType.STRING_SHORT_TYPE if length is 255 or less
DataSource.DataType.STRING_LONG_TYPE if length is greater than 255
lengthlength
decimalPlaces0

Returns a new column of data type STRING_SHORT_TYPE or STRING_LONG_TYPE, with the specified name and length.

public static DataSource.Column text(String name, Integer length)

  • name:

    Type: String

    Name of the column.

  • length:

    Type: Integer

    Number of characters allowed in the column.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.STRING_SHORT_TYPE if length is 255 or less
DataSource.DataType.STRING_LONG_TYPE if length is greater than 255
lengthlength
decimalPlaces0

Returns a new column of data type STRING_SHORT_TYPE with the specified name and the length of 255 characters.

public static DataSource.Column text(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.STRING_SHORT_TYPE
length255
decimalPlaces0

Returns a new column of data type STRING_LONG_TYPE with the specified name and the length of 32,000 characters.

public static DataSource.Column textarea(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.STRING_LONG_TYPE
length32000
decimalPlaces0

Returns a new column of data type Time with the specified name.

public static DataSource.Column time(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

Returns a new column of data type URL_TYPE with the specified name and length.

public static DataSource.Column url(String name, Integer length)

  • name:

    Type: String

    Name of the column.

  • length:

    Type: Integer

    Number of characters allowed in the column.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.URL_TYPE
lengthlength
decimalPlaces0

Returns a new column of data type URL_TYPE with the specified name and the length of 1,000 characters.

public static DataSource.Column url(String name)

  • name:

    Type: String

    Name of the column.

Type: DataSource.Column

The returned column has these property values.

PropertyValue
namename
labelname
descriptionname
isSortabletrue
isFilterabletrue
typeDataSource.DataType.URL_TYPE
length1000
decimalPlaces0