Skip to main content

Converters in Creatio Mobile

Level: advanced

Converters are functions that modify the value of the ViewModel attribute bound to a property of the visual component.

Creatio provides the following base converters for Creatio Mobile.


crt.ToObjectProp

Retrieve the value of the specified object property. Returns the value of a given object property, or the default value if the property is missing or empty.

Parameters

Parameter

Type

Required

Description

prop

string

Yes

The name of the property to retrieve.

defaultValue

any

No

The value to return if the property does not exist or the response is "false."

Usage example
viewConfig schema section
"viewConfig": {
"caption": "$Contact | crt.ToObjectProp:'Name':'Unknown contact'"
}

crt.InvertBooleanValue

Convert the boolean type value to the opposite boolean type value. For example, if the incoming value is "true," the converter returns "false," and vice versa.

Usage example
viewConfig schema section
"viewConfig": {
"visible": "$IsCaseLocked | crt.InvertBooleanValue"
}

crt.IsEqual

Compare the bound ViewModel attribute value to the parameter passed to the converter. Returns "true" if the values are equal. Otherwise, it returns "false."

Parameters

Parameter

Type

Required

Description

compareValue

any

Yes

The value to compare the incoming value against. Supports collections.

Usage example
viewConfig schema section
"viewConfig": {
"visible": "$CaseStatus | crt.IsEqual:'Closed'"
}

crt.AndBooleanValue

Perform a logical AND operation between the incoming value and the parameter. Returns the result of the logical AND operation, or null if either value is not a boolean type value.

Parameters

Parameter

Type

Required

Description

value

boolean

Yes

The boolean value to apply in the AND operation.

Usage example
viewConfig schema section
"viewConfig": {
"visible": "$IsOpportunityOpen | crt.AndBooleanValue:$CanEditOpportunity"
}

crt.IsInArray

Check if the specified array contains the incoming value. Returns "true" if it finds the value in the array. Otherwise, it returns "false."

Parameters

Parameter

Type

Required

Description

array

array

Yes

The array of values to check against.

Usage example
viewConfig schema section
"viewConfig": {
"visible": "$LeadStatus | crt.IsInArray:['New', 'InProgress']"
}

crt.Concat

Join the items of a collection into a single string using an optional separator. Returns the joined string.

Parameters

Parameter

Type

Required

Description

separator

string

No

The string used to join the items.

Usage example
viewConfig schema section
"viewConfig": {
"caption": "$ContactTags | crt.Concat:', '"
}

crt.ToCollectionFilters

Build query filters based on the collection's selection state. This includes both selected and unselected items, along with the data source context. Returns the query filters built from the collection's selection state.

Parameters

Parameter

Type

Required

Description

itemsAttributeName

string

Yes

The path to the collection attribute.

selectionState

object

No

The object defines which items are selected. The type property defines the selection mode:

  • use "specific" to select individual items
  • use "all" to select all items.

The selected and unselected properties each accept an array of items.

Usage example
viewConfig schema section
"viewConfig": {
"filters": "$Contacts | crt.ToCollectionFilters:'Contacts':$ContactsSelectionState"
}