How can I make other column as primary key?
Application Type

I want fetch employee details from local database  on the basis of  Employee number, but I am not able to make Employee number as primary key because already I have Id as default primary key of the entity.

Please help me.


Hi Rekha,

In OutSystems, it is not possible to have composite keys because only one attribute can be the Entity Identifier. But you can use indexes to create alternate keys (see more below about indexes).

You can learn more about this in this link:



Hello Rekha,

Hope you're doing well.

You can define your Primary Key as an Integer, Long Integer and Text. So you could easily get rid of the ID and make your Employee Number to be your Primary Key.

However, you shouldn't do that since it is not a good practice. You should keep the ID (as the Primary Key) and have the Employee Number as another column of your table.

What you can do is to create an unique index in the database for this attribute. In order to do that, you should do this:

You can check more information here.

Also, you should validate in the logic by the time you are inserting a new record. This means that, everytime you are about to create a new record in the entity, you should validate if there is already a record with the same Employee Number.

Back to the query (fetch employee details from the database), you don't need to filter by the ID or by the primary key. You can filter according to your needs. Therefore, you can use the EmployeeNumber attribute to fetch for the details.

Hope that this helps you!

Kind regards,

Rui Barradas

Yes, you can do it through the index, or make it a primary key, but it would be difficult if there are multiple primary key in the same table i guess.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.