Entities
📖In Activator, an Entity represents a structured collection of information, where each record (or instance of the Entity) corresponds to a row in a table. It is comparable to a table in a relational database. The columns of the entity are defined by the properties of the Entity, which are based on Data Types. Entities are used to organize and manage data, making it accessible and manipulable within the system.
How To Create An Entity
In Activator Admin, Entities are located within the menu container, among the items listed under ⚙️Entities. As shown at (1) on the image below.
✋NB:
Make sure you are in the Entities main module.
After initiating the creation of the Entity, by clicking on the +Add new button (illustrated at (2) on the image above), you’ll observe a form (illustrated at (3) on the image above) appearing on the right side with some fields
🔬After filling in the name and description fields, let's focus on the Definition and Meta Data fields.
The Meta Data field gathers and provides additional information for the component. Regarding the data present in this field, we will mainly focus on the ui
property further down in the Entity UI section. For more information on the other properties contained in this field, please refer to Meta Data for the complete list of additional information related to this component.
Note✍️ that this is where you will be prompted to complete various fields for the creation of an Entity. These fields will be used to define the attributes and their specific properties for the Entity.
{
"implements": [
"sys.datatypes.sysEntity"
],
"baseEntity": "",
"resourceName": "",
"nameResKey": "",
"descResKey": "",
"title": "NewEntity",
"description": "NewEntity",
"constraints": [],
"operations": [],
"documentDirectories": [],
"events": [
{
"name": "OnBeforeRecordCreated",
"arguments": [
{
"name": "Model",
"dataType": "string",
"description": "The new record's model (in JSON format)."
}
]
},
{
"name": "OnRecordCreated",
"arguments": [
{
"name": "RecordId",
"dataType": "guid",
"description": "The identifier of the entity record"
}
]
},
{
"name": "OnBeforeRecordUpdated",
"arguments": [
{
"name": "RecordId",
"dataType": "guid",
"description": "The identifier of the entity record"
},
{
"name": "Path",
"dataType": "string",
"description": "The path being updated."
},
{
"name": "AttributeValues",
"dataType": "string",
"description": "The list of name/value pairs (in JSON format)."
}
]
},
{
"name": "OnRecordUpdated",
"arguments": [
{
"name": "RecordId",
"dataType": "guid",
"description": "The identifier of the entity record"
},
{
"name": "Path",
"dataType": "string",
"description": "The path updated."
},
{
"name": "AttributeValues",
"dataType": "string",
"description": "The list of name/value pairs (in JSON format)."
}
]
}
],
"eventHandlers": []
}
JSON Description
Let's see how each property contributes to the definition and configuration of the Entity in the system.
PROPERTY | REQUIRED | DEFAULLT VALUE | DESCRIPTION |
---|---|---|---|
implements | Yes | sys.datatypes.sysEntity | This property is used to specify the Data Type that the Entity can include or implement. By default, each Entity must include the |
baseEntity | No | "" | Is used to specify a base entity from which this Entity will inherit. |
resourceName | No | "" | Used to define the name of the resource associated with the Entity. |
nameResKey | No | "" | This resource key is used to translate the Entity title |
descResKey | No | "" | Translation key for entity description |
title | No | "" | Specifies Entity title |
description | No | "" | This field provides a textual description of the Entity. |
constraints | No | [] | Contains constraints that apply to the data type fields implemented by this Entity. To find out more about constraints, see the detailed section here. |
operations | No | [] | The Please visit the Operations section to find out more. |
documentDirectories | No | [] | This property is used to define the directories or folders where documents associated with the Entity will be stored and managed Please visit the Document directories section to find out more. |
events | No |
| Contains the list of events that this entity can listen to Note: This field is for documentation purposes only. Its role is to inform the developer about the possible events to listen for, as well as the different arguments/parameters they need to consider.A Go to the Events section to learn more about the events linked to the Entity and how they can be utilized. |
eventHandlers | No | [] | This field contains the list of events to be listened to by this entity. Each item in the list should specify the event name and the handler responsible for processing it. Example:
Go to the Events Section to learn more about the events linked to the Entity and how they can be utilized. |
Property constraints
It defines the rules and limitations applied to the fields of the Data Types implemented by the Entity. These constraints are essential for maintaining data integrity and ensuring that the values stored in the fields meet specific conditions. By setting these constraints, you ensure that the data entered into the system is valid, consistent, and compliant with the required standards, helping to prevent errors and maintain data quality.
Add A Constraint
The definition of a constraint is done using the following format:
{
"name": "FK_Order_Company",
"description": "The company recordId",
"type": "",
"isActive": "true",
"definition": { /* Contains the actual definition of the constraint. It varies depending on the type. */}
}
PROPERTY | DESCRIPTION |
---|---|
name | Name of constraint, used to identify it in the system. |
description | Description of the constraint, explaining its function and purpose. |
type | Type of constraint. |
isActive | Indicator of the state of the constraint, to tell whether it should be taken into account or not. |
definition | Details of the constraint |
List Of constraint types
ForeignKey
The
ForeignKey
constraint checks the values of the field it is applied to, ensuring that each value is unique and corresponds to a primary key in another Entity, thus ensuring that the data is correctly linked between Entities.Here's an example configuration:
"constraints": [ { "name": "FK_Order_Company", "description": "The company recordId", "type": "ForeignKey", "isActive": "true", "definition": { "route": "", "attribute": "recordId", "reference": "activatord.accounts.company" } }, { "name": "FK_Order_Products", "description": "The order Products", "type": "ForeignKey", "isActive": "true", "definition": { "route": "products", "attribute": "recordId", "reference": "activatord.entities.catalog" } } ]
Property Description🎨 :
PROPERTY | DESCRIPTION |
---|---|
route | Indicates the path or route to the constraint reference. |
attribute | Field value in entity |
reference | Reference to the external entity linked by the foreign key. |
Unique
The
Unique
constraint ensures that the values of a particular field are unique within all the records of the Entity.Here's an example of a configuration for a uniqueness constraint:
"constraints": [ { "name": "Uq_EmailAddress", "description": "The company recordId", "type": "Unique", "isActive": "true", "definition": { "route": "", "attribute": "emailAddress" } } ]
Property Description🎨 :
PROPERTY | DESCRIPTION |
---|---|
route | |
attribute | Unique value of the field in the entity. |
Property operations
⌛The operations
property allows you to define the specific processing and modifications that must be applied to entity records, while ensuring that each action is properly logged for subsequent tracking.
Configuration example for the operations
property :
"operations": [
{
"name": "UpdateResidenceLocation",
"title": "Update the member residence location",
"description": "Used to update the member residence location",
"handler": "activatord.entityoperationhandlers.updateMemberResidence",
"arguments": [
{
"name": "memberRecordId",
"title": "The member record id",
"description": "The member record identification",
"dataType": "guid"
},
{
"name": "locationModel",
"title": "The location JSON Model",
"description": "The new residence location JSON Model",
"dataType": "activatord.datatypes.localization"
}
]
}
]
PROPERTY | DESCRIPTION |
---|---|
name | Identifies the operation uniquely. |
title | Provides a descriptive title for the operation. |
description | Offers a detailed explanation of what the operation does. |
handler | Specifies the eventhandler that will carry out the operation. |
arguments | Lists the arguments required for executing the operation. Each argument includes:
|
How To Perform An Operation
On Activator, the developer can execute an operation of an Entity by calling the provided API. You can call this API to perform various operations on Entity records. Here are the details for using this API:
PROPERTY | DESCRIPTION |
---|---|
URL |
|
Method | POST |
Payload (Request Body) | The request body must be in JSON format and include information as in the following example:
|
This API can be called from various forms or interfaces to execute specific operations on Entity records. This allows for dynamic data processing and enables the execution of complex actions directly from the user interface or other system integration points.
How To Display An Operation
On Activator the operation data is retrieved and presented to the user to ensure transparency and traceability of the actions performed.
There are two main ways to display an operation:
Via the direct API
The API mentioned below can be used to retrieve operation data directly from the server. The retrieved information can then be displayed to the user via a user interface.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
Method | GET |
By directly calling the operation driver associated with the Entity
By directly calling the operation driver associated with the Entity
This method allows for integrating the operation UI directly linked to the Entity.
To create an operation driver, you need to access the items listed under Entities and click on (1) as illustrated in the image below👇:

After initiating the creation of the Operation Driver, by clicking on the +Add new button (illustrated at (2) on the image above), you’ll observe a form (illustrated at (3) on the image above) appearing on the right side with some fields.
⏳After filling in the name and description fields, let's focus on the Definition and Meta Data fields.
The Meta Data field gathers and provides additional information for the component, please refer to Meta Data for the complete list of additional information related to this component.
As for the Definition field, this is where the default code is defined to help you create an operation driver. Here is a detailed description of the code👇:
$activator.ui.jsmodules.define(function () {
// Called to initialize the driver
this.initialize = function (context) {
return new Promise((resolve, reject) => {
resolve();
});
};
// Render the content
this.render = function (context) {
return new Promise((resolve, reject) => {
resolve();
});
};
});
The code uses the define function from $activator.ui.jsmodules
to define a new JavaScript module. This module corresponds to an operation driver that will be used to manage and display operations related to an Entity.
PROPERTY | DESCRIPTION |
---|---|
initialize | Is called to set everything that needs to happen before the operation is displayed. |
render | Function is responsible for rendering the visual content or the user interface of the operation. This is where the developer typically calls the API and applies dynamic rendering to the operations based on the retrieved data. |
context Parameter | It contains all the necessary elements and parameters that the developer wishes to pass when instantiating the operation driver. For example, this is where information such as the container and various details related to the operation will be provided. |
Property documentDirectories
The documentDirectories
property in an Entity allows for the creation of an organized folder structure to store and manage documents associated with that Entity. This feature is essential for structuring folders hierarchically, which simplifies the access, management, and display of documents in the system.
Here is an example of the documentDirectories
property and an explanation of its structure:
"documentDirectories": [
{
"name": "folder1",
"title": "Folder 1",
"description": "Folder 1",
"nameResKey": "",
"descResKey": "",
"subdirectories": []
},
{
"name": "folder2",
"title": "Folder 2",
"description": "Folder 2",
"nameResKey": "",
"descResKey": "",
"subdirectories": [
{
"name": "subFolder1",
"title": "Sub Folder 1",
"description": "Sub Folder 1",
"nameResKey": "",
"descResKey": "",
"subdirectories": []
},
{
"name": "subFolder2",
"title": "Sub Folder 2",
"description": "Sub Folder 2",
"nameResKey": "",
"descResKey": "",
"subdirectories": []
}
]
}
]
Each folder in the documentDirectories
property is represented by an object containing information such as:
PROPERTY | DESCRIPTION |
---|---|
name | This field uniquely identifies the folder. The name is used to reference the folder within the system and must be distinct for each folder within the same Entity. |
title | The title provides a descriptive name for the folder, often used in the user interface to represent the folder in a user-friendly way. |
description | This field offers an explanation or summary of the folder's content or purpose. It can be used to provide additional information about what the folder contains or its utility. |
nameResKey | This is a key used for translating the title into different languages. It is based on the value of the resourceName property defined at the root of the Entity creation. |
descResKey | This key is used to translate the description. Similar to nameResKey , this key uses the value of the Entity’s resourceName property to provide an appropriate translation of the folder description. |
subdirectories | This property is a list of subfolders nested under the main folder. It allows for creating a hierarchical structure by defining other folders within it. Each subfolder can, in turn, have its own subfolders, enabling the construction of complex directory trees. |
These folders and subfolders defined in the documentDirectories
property can be viewable in Activator Client via the document module.
Property events
This property contains the list of events that this entity can listen to.
✋NOTE:
This field is for documentation purposes only. Its role is to inform the developer about the possible events to listen for, as well as the different arguments/parameters they need to consider.
[
{
"name": "OnBeforeRecordCreated",
"arguments": [
{
"name": "Model",
"dataType": "string",
"description": "The new record's model (in JSON format)."
}
]
},
{
"name": "OnRecordCreated",
"arguments": [
{
"name": "RecordId",
"dataType": "guid",
"description": "The identifier of the entity record"
}
]
},
{
"name": "OnBeforeRecordUpdated",
"arguments": [
{
"name": "RecordId",
"dataType": "guid",
"description": "The identifier of the entity record"
},
{
"name": "Path",
"dataType": "string",
"description": "The path being updated."
},
{
"name": "AttributeValues",
"dataType": "string",
"description": "The list of name/value pairs (in JSON format)."
}
]
},
{
"name": "OnRecordUpdated",
"arguments": [
{
"name": "RecordId",
"dataType": "guid",
"description": "The identifier of the entity record"
},
{
"name": "Path",
"dataType": "string",
"description": "The path updated."
},
{
"name": "AttributeValues",
"dataType": "string",
"description": "The list of name/value pairs (in JSON format)."
}
]
}
]
Description📺:
PROPERTY | ROLE |
---|---|
name | Identifies the event. The name is used to reference and trigger the event. |
arguments | Defines the data transmitted to the event when it is triggered. Each argument includes: - |
List Of Native Events For An Entity
Here is the list of native events you can define for an Entity, along with their details:
EVENT name | DESCRIPTION | ARGUMENTS |
---|---|---|
OnBeforeRecordCreated | This event is triggered before the creation of a new record. | Model : The model of the new record (in JSON format). |
OnRecordCreated | This event is triggered after the creation of a new record. | RecordId : The ID of the entity record. |
OnBeforeRecordUpdated | This event is triggered before updating an existing record. |
|
OnRecordUpdated | This event is triggered after updating an existing record. |
|
Event Configuration
Configuring an event for an entity simply involves defining which event handler will be responsible for processing the said event. These event handlers are functions or scripts that respond to the events defined in events.
Here's an example configuration:
"eventHandlers": [
{
"eventName": "OnRecordCreated",
"handler": "activatord.eventhandlers.newEventHandler1"
}
]
Entity UI
The ui
property can be found in the JSON content of the Meta Data field you have at creation time, or in the content of the Additional Info tab.
This property is defined by:
{
"driver": "",
"layout": "",
"icon": ""
}
it defines:
PROPERTY | ROLE |
---|---|
driver | This driver-type component is responsible for managing the visual rendering of an entity record. |
layout | This layout-type component is responsible for managing the visual structure and rendering of an entity record. |
icon | represents a graphic icon associated with the Entity on Activator Admin. |
✋NB: In Activator, the
layout
anddriver
are not used together and do not need to be defined simultaneously. However, if both are defined, thelayout
takes precedence over thedriver
for rendering the record.
The following properties are defined as Meta Data.
How To Create Entity Driver
To create an entity driver, you need to access the items listed under Entities and click on the highlighted item as illustrated in the image below👇:

Being a driver-type component, the Entity Driver has all the methods and functionalities available in this component. To learn more about this component, please refer to the Driver.
How To Create Entity Layout
To create an entity Layout, you need to access the items listed under Entities and click on the highlighted item as illustrated in the image below👇:

Being a Layout-type component, the Entity Layout has all the properties and functionalities available in this component. To learn more about this component, please refer to the Layout.
Entity APIs
These APIs facilitate entity management by providing endpoints to obtain information about their structure, perform actions on records, and view associated events. Through these interfaces, developers can seamlessly integrate and manipulate entities, ensuring efficient interaction with the data.
Get The Model Of An Entity
This access point retrieves the complete model of the specified entity. This will help you understand the data model to send for creating a new record.
API Details
PROPERTY | DESCRIPTION |
---|---|
URL |
|
Method | GET |
Get The Type Of An Entity
This API provides information on the type of every field of the datatype impleted by the entity.
API Details
PROPERTY | DESCRIPTION |
---|---|
URL |
|
Method | GET |
Create Records
Push a single records
This operation allows you to create a single record within a specified entity.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | PUT |
PAYLOAD(BODY) |
|
RESULT | string (new record id) |
Push many records
This operation enables you to create multiple records for a specified entity in a single request. It is useful for bulk record creation.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | PUT |
PAYLOAD(BODY) |
|
RESULT | payload: true |
Updates
Update Entity Record
Use this endpoint to update a specific record within an entity.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | POST |
PAYLOAD (BODY) |
|
RESULT | payload: true |
Update Language Resource
This endpoint updates language resources associated with a specific record. For more details on how to date translations, refer to the Database Translation.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | POST |
PAYLOAD (BODY) |
|
RESULT | payload: true |
Update Many Records
This operation allows you to update multiple records for a specified entity in one request, useful for bulk updates.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | POST |
PAYLOAD (BODY) |
|
RESULT | payload: true |
Children
Create
This endpoint enables you to create a child record for a specified parent record within an entity.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | PUT |
PAYLOAD (BODY) |
|
RESULT | string (new record id) |
Update
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | POST |
PAYLOAD (BODY) |
|
RESULT | payload: true |
Delete
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | DELETE |
PAYLOAD (BODY) |
|
RESULT | payload: true |
Activate Entity
This operation activates an entity record, making it available for use.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | GET |
RESULT | payload: true |
Deactivate Entity
Deactivates an entity record, making it inactive and unavailable.
PROPERTY | DESCRIPTION |
---|---|
URL |
|
METHOD | GET |
RESULT | payload: true |
Conclusion
In conclusion, the Entity component in Activator is a robust system for organizing, managing, and manipulating structured data. Entities, comparable to tables in a relational database, form the foundational elements of data storage and offer extensive customization through properties, operations, events, and document directories. The ability to define operations ensures traceability of actions on the data, while events enable dynamic responses to changes occurring within the system. Additionally, the use of APIs allows users to create sophisticated data management solutions tailored to their needs.
With a good understanding of these fundamental elements, you can now explore more specialized entities such as task, business processes, and others, which provide advanced capabilities for managing complex workflows and automating processes within the Activator environment.