117
Views
5
Comments
How to Reset the Entity ID
Question
Application Type
Reactive

Hello

I want to test the application. Records are created during testing. For example, let us say that 5 records are created. After testing, I want to reset them to 1, 2,...., and so on, rather than 6, 7...

Thanks,

Nihil


UserImage.jpg
Dinesh kumar M

Hi Nihil,

In Outsystems, Once an record is created in an entity its ID is auto incremented value only and it cannot be reset.

Kindly refer the link for more understanding related to Entities, https://success.outsystems.com/documentation/11/building_apps/data_management/data_modeling/entities/


Best Regards,

Dinesh Kumar

2018-11-30 08-20-55
Hendra

Hi Nihil,

If it's necessary, you can run SQL Query with command "TRUNCATE {your entity table}", if this entity id is still used in another entities, you need to delete it first in those entities

Be aware, this command will delete all your data in that entity

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Hendra,

As far a I know, TRUNCATE does not reset the identity value. For that you need DBCC CHECKIDENT.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Nihil,

Like others have said, without access to the database itself, this is generally not possible. However, if you are certain the entity is empty, you can cut/paste the entity in Service Studio and publish. This will create a new table in the database, starting with Id 1.

2025-08-03 07-20-35
Mythily - EONE

Hi,

Do you want reset the ID, during runtime itself? or in what scenario you need to achieve this?

Instead of resetting ID , you can have reference column, based on certain conditions  you can reset the reference number, 


Thanks

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