Render repeated Freedom UI components
This functionality is available for Creatio 8.1.5 and later.
Display a dynamic list of repeated Freedom UI components using the crt.TemplateList component in the Freedom UI page schema based on template and specific conditions. For example, the list of AI Skills that are connected to Creatio.ai chat panel. This provides a seamless and scalable way to build Freedom UI lists based on runtime data with minimal effort.
To render repeated Freedom UI components:
-
Implement the data source. For example, implement the data source that receives the AI Skill list from the
CopilotIntentobject schema.modelConfigDiff schema sectionmodelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[
{
"operation": "merge",
"path": [
"dataSources"
],
"values": {
"CopilotQuickActionsDS": {
"type": "crt.EntityDataSource",
"scope": "viewElement",
"config": {
"entitySchemaName": "CopilotIntent",
"attributes": {
"Name": {
"path": "Name"
}
}
}
}
}
}
]/**SCHEMA_MODEL_CONFIG_DIFF*/ -
Add an attribute.
- Go to the
viewModelConfigDiffschema section →valuesconfiguration object. - Add an attribute that stores a list of elements to display. For this example,
CopilotQuickActions. The data source is theCopilotIntentschema whoseNamecolumn values are displayed as the titles of the Button component.
viewModelConfigDiff schema sectionviewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
{
"operation": "merge",
"path": [
"attributes"
],
"values": {
...,
"CopilotQuickActions": {
"isCollection": true,
"modelConfig": {
"path": "CopilotQuickActionsDS"
},
"viewModelConfig": {
"attributes": {
"CopilotQuickActionsDS_Name": {
"modelConfig": {
"path": "CopilotQuickActionsDS.Name"
}
}
}
}
}
}
}
]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/ - Go to the
-
Set up rendering parameters.
-
Bind an attribute to the page element.
- Go to the
viewConfigDiffschema section → corresponding page element →valuesconfiguration object whosetypeproperty is set tocrt.TemplateList. Learn more: TemplateList component. - Bind the model attribute to the
itemsproperty. For this example,CopilotQuickActions.
- Go to the
-
Implement the
templatearray of objects to render repeated Freedom UI components. -
Implement the
classesarray of CSS classes to customize the appearance and layout of thecrt.TemplateListcomponent.
viewConfigDiff schema sectionviewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
{
"operation": "insert",
"name": "Conversation",
"values": {
"type": "crt.TemplateList",
"items": "$CopilotQuickActions",
"direction": "row",
"gap": 32,
"template": [
{
"type": "crt.Button",
"caption": "$CopilotQuickActions.CopilotQuickActionsDS_Name",
"size": "medium",
"clicked": {
"request": "crt.CopilotActionRequest",
"params": {
"prompt": "$CopilotQuickActions.CopilotQuickActionsDS_Name"
}
}
}
],
"classes": [
"copilot-actions-list"
]
},
"parentName": "MainContainer",
"propertyName": "items",
"index": 0
}
]/**SCHEMA_VIEW_CONFIG_DIFF*/ -
As a result, a dynamic list of repeated Freedom UI components will be displayed.