Documentation
Getting Started
Data Grid
Business Rules
Approvals
Users, Roles & Security
Administration
Integration & API
Installation
Migrating from MDS
Architecture
Documentation/Modeling/Entity Management

Entity Management

Clone, purge and delete an entity from the row actions in the Models list. All three are available in both the card view and the list view.


Clone an entity

Click the copy icon on any entity.

The dialog offers:

  • New name — a unique name for the clone
  • Clone data — copy all data rows. On by default
  • Clone permissions — copy entity-level group permissions. Off by default

All attributes, derived columns and approvers are deep-cloned with new IDs. Domain attribute references within the same entity are remapped to the cloned rows.

Clone progress bar
Clone progress bar(click to enlarge)

Progress — the structure is cloned first, then the data in batches of 5,000 rows, with a live count such as Copying data: 15,000 / 99,000 rows and a percentage. Batching means the operation never times out, however large the entity.

Large entities: at 10,000 rows or more the dialog warns that the transaction log can grow. Shrink the database after the clone completes.

Purge entity data

Click the amber trash icon to remove every data row while keeping the entity itself.

The dialog has three parts:

  1. A red banner explaining that all rows, attribute values and domain references are deleted permanently.
  2. A Save data snapshot to Audit Log checkbox, unchecked by default.
  3. A confirmation field. Type the exact entity name to enable Purge all data.

When the entity uses Auto-generate Code, a further option appears:

Restart code numbering — leave it unticked and numbering continues where it left off, so a code is never reused. Tick it and the next generated code starts from the beginning, which means codes from the deleted rows are handed out a second time. Anything still referring to one of them will then point at a different record.

The dialog also shows the SQL to read the snapshot back out of the audit log, with a copy button.

The purge is always recorded in the audit log with the action purge and the number of deleted rows. The entity definition — attributes, derived columns, permissions — is untouched.


Delete an entity

Click the trash icon to delete the entity and all its data.

Before the button enables, the dialog checks two things:

  1. Domain usage — if other entities reference this one as a domain source, each is listed as *entity → attribute*. You must tick I understand — clear all domain values and delete this entity to continue.
  2. Name confirmation — type the exact entity name.

A Save data snapshot to Audit Log checkbox appears whenever the entity holds rows. It is unchecked by default.

Progress — a bar reports each phase, attribute values, approval rows, entity rows, then metadata cleanup, with a percentage and a running count such as 45,000 / 200,000 items deleted. Rows are deleted in batches so large entities do not time out.

Large entities: at 10,000 rows or more the dialog warns about transaction log growth.

Data snapshots

OperationSnapshot behavior
Row delete in the gridA full snapshot is always saved. Every deleted row is stored as JSON in the audit log, with no action from you
Purge entity dataYou choose. The checkbox is unchecked by default
Delete entityYou choose. The checkbox is unchecked by default

When the checkbox is ticked, all rows are captured as a JSON array in the Details column of the AuditLog table before anything is deleted. Above 10,000 rows a note warns that this takes a moment.


Recover deleted data

A snapshot is stored as JSON, so you can restore rows without a database backup.

Step 1 — read the snapshot out of the audit log. Use Action = 'delete' for row deletes, 'purge' for a purge, or 'delete_entity' for a deleted entity:

-- Extract deleted rows as JSON
-- Use Action = 'delete', 'purge', or 'delete_entity'
SELECT Details
FROM AuditLog
WHERE Action = 'delete'
  AND EntityName = 'YourEntityName'
ORDER BY Timestamp DESC;

SSMS truncates long text in the grid. Use Results to File (Ctrl+Shift+F before running the query) to save the full output, or write it directly with BCP:

-- Write snapshot to a file using BCP
-- Replace YourEntityName, the Action value, and the output path
DECLARE @cmd NVARCHAR(4000);
DECLARE @sql NVARCHAR(MAX) = N'SELECT Details FROM AuditLog WHERE Action = ''purge'' AND EntityName = ''YourEntityName'' ORDER BY Timestamp DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY';
SET @cmd = N'bcp "' + @sql + N'" queryout "C:\Temp\deleted_data.json" -S 127.0.0.1 -d Primentra -T -c -C 65001';
EXEC xp_cmdshell @cmd;

Step 2 — import the JSON back.

  1. Save the extracted JSON as a .json file.
  2. Open the target entity in the data grid.
  3. Click Import in the toolbar.
  4. Drop or select the file.
  5. Map the columns and choose a conflict action — Skip existing to restore only missing rows, Overwrite to replace current values.
  6. Review and confirm.

The JSON matches what the import wizard expects: each object has code, name, and every attribute display name as a key. No manual transformation is needed.

If the entity itself was deleted, recreate it with the same attributes before importing. Model Export / Import can restore the structure from another environment.

Ready to get started?

Start managing your master data with Primentra today.

View Pricing
Entity Management | Modeling | Docs | Primentra