Automatic data binding
Use the automatic data binding mechanism on the data of objects with a complex object model. Automatic data binding is available for product catalog in Financial Services Creatio product lineup.
Structure of automatic data binding
View the components of automatic data binding in the table below.
Components of automatic data binding
Name | Purpose | Classes and interfaces |
---|---|---|
Service | Generates data bindings based on the set structure Creatio generates data bindings in the background. |
|
Controller | Accesses the |
|
Binding generator | Wraps the |
|
Structure obtainer | Returns the structure of the main entity’s bound records to the controller. |
|
Creatio implements the base structure, within which only the current entity and its columns (except for system columns) are returned. View the properties of the base structure in the table below.
Properties of the base structure of bound entities
Property | Description |
---|---|
| The name of the entity. |
| The array of paths to the main entity’s primary column. If you use filters, join them using the |
| The way to save the records. The ways to save the records are as follows: * Save the records to a single binding. * Create a binding per each record bound to the main entity record via the filter. |
| The list of columns to bind. |
| The list of nested objects’ structures. For example, details connected to the main entity. |
| The list of structures on which the current structure depends. For example, lookups to which the record in the current structure links via lookup fields. |
Operating procedure of automatic data binding
View the operating procedure of automatic data binding in the figure below.
Creatio starts processing the structure from the main entity. The structure is processed for each instance of the SchemaDataBindingStructure
structure class.
The structure processing procedure is as follows:
- Creatio recursively processes each structure from the list of structures contained in the
DependsStructures
property. This is done to bind the objects to which the current object links before binding the main entity. - Creatio adds the binding to the main entity record by the filter in the
FilterColumnPathes
property. - Creatio recursively processes each structure from the list of structures contained in the
InnerStructures
property. Since the structures reference the main entity, bind them after binding the main entity.
The following naming patterns are available:
agb_EntitySchemaName
if theIsBundle
property istrue
.EntitySchemaName
is the name of the current binding’s entity.agb_EntitySchemaName_PrimaryEntityId
if theIsBundle
property isfalse
.PrimaryEntityId
is the ID of the main entity record to which the records in the current binding are bound.
We recommend against renaming automatically created bindings. Automatic updates are available only for the bindings whose names match the specified template.
Add a custom structure for the object binding
-
Create a Source code schema. Learn more about creating schemas in a separate article: Source code (C#).
-
Create a service class.
-
Add the
Terrasoft.Configuration
namespace in the Schema Designer. -
Create a class. Name the class according to the following template:
[EntityName]SchemaDataBindingStructureObtainer
. For example,ProductSchemaDataBindingStructureObtainer
. Creatio will search for classes based on the template when defining the relevant obtainer implementation (theObtainer
component). -
Specify the
BaseSchemaDataBindingStructureObtainer
class as a parent class. -
Add a custom implementation of the
ObtainStructure()
interface method. Create and return the needed entity structure in this method.ObtainStructure() methodpublic override SchemaDataBindingStructure ObtainStructure(UserConnection userConnection)
ImportantIf you need to modify a structure implementation from a non-editable package, create a class in a user-made package and use the
[Override]
attribute. Learn more about the attribute in a separate article:[Override]
attribute.
-
-
Publish the source code schema.
Call automatic data binding
You can call automatic data binding from the front-end and back-end.
Call automatic data binding from the front-end
-
Call the service that generates bindings.
-
Specify the binding generation settings.
You can specify binding generation settings in the following ways:
-
Pass the parameters.
- package for which to generate the binding
- name of the entity
- list of IDs to bind
-
Pass the filter.
-
View the example that calls automatic data binding from the front-end using the parameters below.
ServiceHelper.callService("SchemaDataBindingService",
"GenerateBindings",
callback, {
"schemaName": this.entitySchemaName,
"sysPackageUId": sysPackageUId
"recordIds": ["...", "..."]
},
this
);
View the example that calls automatic data binding from the front-end using a filter below.
ServiceHelper.callService("SchemaDataBindingService",
"GenerateBindingsByFilter",
callback, {
"schemaName": this.entitySchemaName,
"sysPackageUId": sysPackageUId
"filterConfig": ...
},
this
);
Creatio runs automatic data binding called from the front-end in the background. Once the binding is complete, Creatio will display a notification message in the communication panel. The message will contain the number of successfully and unsuccessfully bound product records.
Call automatic data binding from the back-end
-
Create an instance of the
SchemaDataBindingController
class. -
Call the
GenerateBindings
method. Pass the following to the method:- package ID
- entity name
- list of IDs to bind
View the example that calls automatic data binding from the back-end below.
var dataBindingController = ClassFactory.Get<IDataBindingController>(new ConstructorArgument("userConnection", UserConnection));
var result = dataBindingController.GenerateBindings(schemaName, recordIds, sysPackageUId);
See also
Execute operations in the background
Resources
Description of the product catalog in Financial Services Creatio product lineup