attributes property
The functionality is relevant to Classic UI.
The attributes
property of the client schema contains a configuration object with its properties.
Primary properties
dataValueType
The attribute data type. Creatio will use it when generating the view. The Terrasoft.DataValueType
enumeration represents the available data types.
Available values (DataValueType)
GUID | 0 |
TEXT | 1 |
INTEGER | 4 |
FLOAT | 5 |
MONEY | 6 |
DATE_TIME | 7 |
DATE | 8 |
TIME | 9 |
LOOKUP | 10 |
ENUM | 11 |
BOOLEAN | 12 |
BLOB | 13 |
IMAGE | 14 |
CUSTOM_OBJECT | 15 |
IMAGELOOKUP | 16 |
COLLECTION | 17 |
COLOR | 18 |
LOCALIZABLE_STRING | 19 |
ENTITY | 20 |
ENTITY_COLLECTION | 21 |
ENTITY_COLUMN_MAPPING_COLLECTION | 22 |
HASH_TEXT | 23 |
SECURE_TEXT | 24 |
FILE | 25 |
MAPPING | 26 |
SHORT_TEXT | 27 |
MEDIUM_TEXT | 28 |
MAXSIZE_TEXT | 29 |
LONG_TEXT | 30 |
FLOAT1 | 31 |
FLOAT2 | 32 |
FLOAT3 | 33 |
FLOAT4 | 34 |
LOCALIZABLE_PARAMETER_VALUES_LIST | 35 |
METADATA_TEXT | 36 |
STAGE_INDICATOR | 37 |
type
Column type. An optional parameter BaseViewModel
uses internally. The Terrasoft.ViewModelColumnType
enumeration represents the available column types.
Available values (ViewModelColumnType)
ENTITY_COLUMN | 0 |
CALCULATED_COLUMN | 1 |
VIRTUAL_COLUMN | 2 |
RESOURCE_COLUMN | 3 |
value
Attribute value. Creatio sets the view model value to this parameter when the view model is created. The value
attribute accepts numeric, string, and boolean values. If the attribute type implies the use of a lookup type value (array, object, collection, etc.), initialize its initial value using a method.
Use example
attributes: {
/* Attribute name. */
"NameAttribute": {
/* Data type. */
"dataValueType": this.Terrasoft.DataValueType.TEXT,
/* Column type. */
"type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
/* The default value. */
"value": "NameValue"
}
}
Additional properties
caption
Attribute title.
isRequired
The flag that marks the attribute as required.
dependencies
Dependency on another attribute of the model. For example, set an attribute based on the value of another attribute. Use the property to create calculated field.
lookupListConfig
The property that manages the lookup field properties. This is a configuration object that can contain optional properties.
Optional properties
columns | An array of column names to add to a request in addition to the Id column and the primary display column. |
orders | An array of configuration objects that determine the data sorting. |
filter | The method that returns an instance of the |
filters | An array of filters (methods that return collections of the |
Use example
attributes: {
/* Attribute name. */
"Client": {
/* Attribute title. */
"caption": { "bindTo": "Resources.Strings.Client" },
/* The attribute is required. */
"isRequired": true
},
/* Attribute name. */
"ResponsibleDepartment": {
lookupListConfig: {
/* Additional columns. */
columns: "SalesDirector",
/* Sorting column. */
orders: [ { columnPath: "FromBaseCurrency" } ],
/* Filter definition function. */
filter: function()
{
/* Return a filter by the [Type] column, which equals the Competitor constant. */
return this.Terrasoft.createColumnFilterWithParameter(
this.Terrasoft.ComparisonType.EQUAL,
"Type",
ConfigurationConstants.AccountType.Competitor);
}
}
},
/* Attribute name. */
"Probability": {
/* Define the column dependency. */
"dependencies": [
{
/* Depends on the Stage] column. */
"columns": [ "Stage" ],
/* The name of the [Stage] column’s change handler method.
The setProbabilityByStage() method is defined in the methods property of the schema object. */
"methodName": "setProbabilityByStage"
}
]
}
},
methods: {
/* [Stage] column’s change handler method. */
setProbabilityByStage: function()
{
/* Get the value of the [Stage] column. */
var stage = this.get("Stage");
/* Condition for changing the [Probability] column. */
if (stage.value && stage.value ===
ConfigurationConstants.Opportunity.Stage.RejectedByUs)
{
/* Set the value of the [Probability] column. */
this.set("Probability", 0);
}
}
}