Back-end (C#)
Glossary Item Box
The development of solutions in Creatio involves different customization levels depending on the type or complexity of a business task. Note that the application core level is an immutable system component. Development in Creatio is done on the configuration level.
Developers can create back-end class instances and use the functionality of back-end libraries implemented on the application core level, but they cannot make any changes in these classes and libraries.
Back-end development areas
Back-end application customization involves:
- the ORM data model and methods of working with it. In most cases, we recommend using the object model, though the direct access to the database is also implemented in the back-end core components
- implementing direct access to the database
- creating and using of the system web service
- setting up integration with external services (for example, the SyncEngine service)
- working with the system components and additional services (for example, the machine learning service)
- extended setup of business processes and built-in processes of the application objects
- developing object business logic.
ORM data model and direct access to the database
The ORM model is implemented in the Terrasoft.Core.Entities namespace classes. The Terrasoft.Core.Entities.EntitySchemaQuery class is used to build queries for selecting records in Creatio database tables. The Terrasoft.Core.Entities.Entity class is designed to provide access to an object that represents a record in the database table
Direct database access is provided by a group of server core classes from the Terrasoft.Core.DB namespace. Use this class group to perform all basic CRUD operations, account for the access permissions of the current user, and put the retrieved data to the cache storage. Learn about classes in more detail in the “Working with database” article.
If fetching the needed data requires a complex database query (for example, several nested filters, various combinations of JOIN commands, etc.), you can query the database directly using the Terrasoft.Core.DB.DBExecutor class.
System web services
Creatio service model implements the base set of web services, which you can use for integration with third-party applications and systems. Examples of system services:
- odata – data exchange with Creatio via the OData4 protocol.
- ProcessEngineService.svc – running Creatio business processes using third-party applications.
Creatio also provides configuration web services designed for calls from the client part of the application.
The developers can create a custom web service designed for solving a project-specific task.
Integration with external services
The core of the application implements classes that provide third-party integration features. For example, the Terrasoft.Social namespace enables integration with social networks.
System components and services
The Terrasoft.Sync namespace provides the classes of the built-in mechanism for synchronization with remote repositories (Sync Engine). Sync Engine enables users to create, modify, and delete Entity objects in Creatio based on the data imported from remote repositories, as well as export data to remote repositories. The synchronization process relies on the SyncAgent class. Learn more about the synchronization mechanism in the “Creatio synchronization with external storages” article.
Set up business processes and built-in processes of the application objects
You can use back-end development to create complex business processes (the [Script-task] process element) or recurrent user’s business process operations (the [User Task] configuration schema).
You can configure the built-in processes of an object using the no-code tools as well as back-end development. Using the program code allows configuring a more flexible object behavior accounting for specific events.
Develop the business logic of objects.
Creatio supports the development of the business logic of an object without using event sub-processes. To do this, make a class that inherits the Terrasoft.Core.Entities.Events.BaseEntityEventListener base core class, decorate it using the EntityEventListener attribute, and specify the name of the entity whose event subscription must be executed. Then, you can reload the handler methods of the required events.< Learn more about this in the “Entity event layer” article.
Tools and utility capabilities for back-end development
Source code schema
The main back-end development method is the creation of [Source code] schemas in the custom package.
All changes to the schema made in the object designer are kept in memory. To save the changes on the schema metadata level, save the schema. To do this, click [Save] in the object designer. To apply the changes to the database, publish the schema.
You can develop [Source code] schemas in the file system development mode using an IDE of your choice. Learn more about the file system development mode in the “Working with the server side source code” article.
Configure business processes
You can enable a specific back-end logic in a business process by introducing the source code in a [Script task] element.
It is often necessary to perform similar operations repeatedly while working with business processes in Creatio. The [User task] process element is best suited for these operations. Specify the most suitable schema title in the [Which user task to perform?] property of the process element. Learn more about the [User task] element in the “[User task] process element” article.
By default, some user tasks are already available in the system. You can add new user tasks if needed.
The “User task” configuration schema type is used to create new user tasks. The process task partially replicates the logic of the [Script task] process element. However, a user task can be reused in different processes. Any changes to the task will be immediately applied to all processes that contain the mentioned task.
External libraries
The structure of a custom package may include external libraries created by the user. This approach supports implementing complex business logic, inheritance mechanism, and encapsulation for developing a project-specific solution.
Project package
The project package model is one of Creatio’s standards for accelerating the development of the server schemas for the application. A project package is a package that enables developing new functionality like a regular C# project. The new functionality is included in the file content package as a compiled dynamic library and a collection of CS files. When starting or restarting, the Creatio application will collect information about pre-set libraries and promptly include them. Learn more about creating a project package in the “Developing the source code in the file content (project package)” article.
Video tutorial