When defining your entities in the module, you should indicate which attribute is the primary key, which uniquely identify the entities' rows. The concept is the same as in relational database management systems, but in the terminology of Service Studio, a primary key is called an Identifier.

By default, when creating an entity in Service Studio, an Integer identifier is created with auto number set to Yes. In this situation, OutSystems Platform guarantees its uniqueness and you don't have to build any specific logic in your module. However, you can use any data type for your Identifier but you must prepare the module with the suitable logic to guarantee its uniqueness.

How to Create an Identifier

You can create an identifier using one of the following options:

What you need to know

In the OutSystems Platform it is not possible to have a composite key, i.e. primary keys can only have one attribute.

Due to this, the primary key of Multi-tenant entities should be an Integer value with the 'Is AutoNumber' property set to 'Yes', since the TenantId attribute is not part of the primary key. For Multi-tenant scenarios where the primary key's type is Text, additional logic should be implemented to ensure that the key is not duplicated when inserting new data into the database.

See Also

Entity Description | Create Entity Attributes | Database Constraints