This is a very particular situation, I believe.

Question: Is it possible in a Multi-Tenant eSpace to mix the use of Single-Tenant static entities with Multi-Tenant entities?

The scenario is this:

In a Multi-Tenant eSpace I have:

1) A Single-Tenant static entity;

2) A Multi-Tenant entity, which:

a) Has an attribute which is a reference to the Single-Tenant static entity;

b) And the Identifier attribute (primary key) is a Text, with, obviously, the property "Is Auto Number" set automatically by the platform to "No".

The problem is:

When I try to bootstrap some records with a timer (which is set to Multi-Tenant) from an excel file for the several tenants, for the first tenant that the timer runs, the records are inserted correctly, but for all the other tenants that the timer runs, it aborts with the error:


Timer XXXX error (inside action 'XXXX'). Timer duration = 15 secs:Violation of PRIMARY KEY constraint 'OSPRK_OSUSR_Z6F_<XXXX>'. Cannot insert duplicate key in object 'dbo.OSUSR_Z6F_<XXXX>'. The duplicate key value is (XXXX)


I'm not getting it. The complaint is about the primary key being inserted duplicately, which doesn't seem to have anything to do with the foreign key of the single-tenant static entity. Can you provide a bit more information about the nature of the Create etc.?

Hello. Sorry for the late reply.

Yes, I now believe the foreign key to the single-tenant static entity is not a problem.

The problem is about the primary key. Since it is set to "Is AutoNumber" to "No" I would expect that different tenants could have records with the same value for the primary key, but does not seem to be the case.

TenantId, PK

1, "ABC"

2, "ABC"

It seems that the above situation is not possible, where I would expect it to be possible.

I will try to create an example espace to reproduce this situation and post it here.


Hi Tiago,

OutSystems doesn't allow composite primary keys, so you'll always need an autonumber, or manually assure the primary key is unique.