Column Class
Describes a column on a DataSource.Table. This class extends the DataSourceUtil class and inherits its methods.
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.
-
If the data type is numeric, the number of decimal places to the right of the decimal point.
-
Description of what the column represents.
-
Whether a result set can be filtered based on the values of the column.
-
isPicklistAlphabeticallySorted
Returns
trueif the picklist is sorted alphabetically,falseotherwise. -
Returns
trueif the picklist is restricted,falseotherwise. -
User-friendly name for the column that appears in the Salesforce user interface.
-
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 of the column in the external system.
-
If the data type is a picklist, the picklist values.
-
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. -
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, orINDIRECT_LOOKUP_TYPE. For other data types, this value is ignored. -
Whether a result set can be sorted based on the values of the column via an
ORDER BYclause. -
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. -
currency(name, length, decimalPlaces)
Returns a new column of data type
CURRENCY_TYPE. -
Returns a new column of data type
DATE_TYPE. -
Returns a new column of data type
DATETIME_TYPE. -
Returns a new column of data type
EMAIL_TYPE. -
Returns a new column of data type
EXTERNAL_LOOKUP_TYPE. -
Returns a new column with the 13 specified
Columnproperty values. -
Returns a new column with the ten specified
Columnproperty values. -
get(name, label, description, isSortable, isFilterable, type, length, decimalPlaces)
Returns a new column with the eight specified
Columnproperty values. -
get(name, label, description, isSortable, isFilterable, type, length)
Returns a new column with the seven specified
Columnproperty values. -
indirectLookup(name, domain, targetField)
Returns a new column of data type
INDIRECT_LOOKUP_TYPE. -
Returns a new numeric column with no decimal places using the specified name and length.
-
Returns a new column of data type
LOOKUP_TYPE. -
multipicklist(name, picklistValues, isPicklistAlphabeticallySorted, isPicklistRestricted)
Returns a new column of data type
PICKLIST_MULTISELECT_TYPEwith the specified name and picklist values. You can also specify whether the picklist is sorted alphabetically or if the picklist is restricted. -
multipicklist(name, picklistValues)
Returns a new column of data type
PICKLIST_MULTISELECT_TYPEwith the specified name and picklist values. -
number(name, length, decimalPlaces)
Returns a new column of data type
NUMBER_TYPE. -
percent(name, length, decimalPlaces)
Returns a new column of data type
PERCENT_TYPE. -
Returns a new column of data type
PHONE_TYPE. -
picklist(name, picklistValues, isPicklistAlphabeticallySorted, isPicklistRestricted)
Returns a new column of data type
PICKLIST_TYPEwith the specified name and picklist values. You can also specify whether the picklist is sorted alphabetically or if the picklist is restricted. -
picklist(name, picklistValues)
Returns a new column of data type
PICKLIST_TYPEwith the specified name and picklist values. -
Returns a new column of data type
STRING_SHORT_TYPEorSTRING_LONG_TYPE, with the specified name, label, and length. -
Returns a new column of data type
STRING_SHORT_TYPEorSTRING_LONG_TYPE, with the specified name and length. -
Returns a new column of data type
STRING_SHORT_TYPEwith the specified name and the length of 255 characters. -
Returns a new column of data type
STRING_LONG_TYPEwith the specified name and the length of 32,000 characters. -
Returns a new column of data type
Timewith the specified name. -
Returns a new column of data type
URL_TYPEwith the specified name and length. -
Returns a new column of data type
URL_TYPEwith the specified name and the length of 1,000 characters.
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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.EXTERNAL_LOOKUP_TYPE |
| length | 255 |
| decimalPlaces | 0 |
| referenceTo | domain |
| referenceTargetField | null |
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.
-
name:
Type: String
-
label:
Type: String
-
description:
Type: String
-
isSortable:
Type: Boolean
-
isFilterable:
Type: Boolean
-
type:
Type: DataSource.DataType
-
length:
Type: Integer
-
decimalPlaces:
Type: Integer
-
referenceTo:
Type: String
-
referenceTargetField:
Type: String
-
picklistValuesObj:
Type: Object
-
isPicklistAlphabeticallySorted:
Type: Boolean
-
isPicklistRestricted:
Type: Boolean
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.
-
name:
Type: String
-
label:
Type: String
-
description:
Type: String
-
isSortable:
Type: Boolean
-
isFilterable:
Type: Boolean
-
type:
Type: DataSource.DataType
-
length:
Type: Integer
-
decimalPlaces:
Type: Integer
-
referenceTo:
Type: String
-
referenceTargetField:
Type: String
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.
-
name:
Type: String
-
label:
Type: String
-
description:
Type: String
-
isSortable:
Type: Boolean
-
isFilterable:
Type: Boolean
-
type:
Type: DataSource.DataType
-
length:
Type: Integer
-
decimalPlaces:
Type: Integer
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.
-
name:
Type: String
-
label:
Type: String
-
description:
Type: String
-
isSortable:
Type: Boolean
-
isFilterable:
Type: Boolean
-
type:
Type: DataSource.DataType
-
length:
Type: Integer
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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.INDIRECT_LOOKUP_TYPE |
| length | 255 |
| decimalPlaces | 0 |
| referenceTo | domain |
| referenceTargetField | targetField |
Returns a new numeric column with no decimal places using the specified name and length.
public static DataSource.Column integer(String name, Integer 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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.LOOKUP_TYPE |
| length | 255 |
| decimalPlaces | 0 |
| referenceTo | domain |
| referenceTargetField | null |
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:
-
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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.NUMBER_TYPE |
| length | length |
| decimalPlaces | decimalPlaces |
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.
| Property | Value |
|---|---|
| name | name |
| label | label |
| description | label |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.STRING_SHORT_TYPE if length is 255 or less DataSource.DataType.STRING_LONG_TYPE if length is greater than 255 |
| length | length |
| decimalPlaces | 0 |
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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.STRING_SHORT_TYPE if length is 255 or less DataSource.DataType.STRING_LONG_TYPE if length is greater than 255 |
| length | length |
| decimalPlaces | 0 |
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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.STRING_SHORT_TYPE |
| length | 255 |
| decimalPlaces | 0 |
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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.STRING_LONG_TYPE |
| length | 32000 |
| decimalPlaces | 0 |
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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.URL_TYPE |
| length | length |
| decimalPlaces | 0 |
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.
| Property | Value |
|---|---|
| name | name |
| label | name |
| description | name |
| isSortable | true |
| isFilterable | true |
| type | DataSource.DataType.URL_TYPE |
| length | 1000 |
| decimalPlaces | 0 |