I need to do one query using SQL Advanced with TenantId. I am trying to do e I am receveing one mistake talking mult-part TenantId could not found. Somebody know how to do one query usingTenantId?


André Luiz

Hello Andre,

Check this link, hope it helps.


Jorge Rodrigues


First you need to make sure you show tenant id column by going to entity --> more --> advanced and entity is marked as multi tenant or module is marked as multi tenant, in my contact entity below Is Multi-tenant option is taken from module and my module is marked as multi tenant.

Once you have the tenant id shown then you can query it as usual in advance query, for example like below

SELECT {Contact}.* 
from {Contact}
where {Contact}.[Tenant_Id] = @TenantId 
order by @OrderBy;

Best if you go through the course https://www.outsystems.com/learn/courses/45/master-class-on-multi-tenancy/. I learned most of the concept from that course.


HI Andre ,

Could you please add some more details about your issue ? There is no difference in writing advance query or writing advance query for multi tenant entities.

@Prasad Rao - Checking "Show Tenant Identifier"  is not required to write multi tenant advance query because the  platform manage this automatically based on the logged in user tenant id. if you check "Show Tenant Identifier" than platform will not add the tenant filter automatically and the query will work for all the tenants.




Correct if you don't check "Show Tenant Identifier" then we will not be able add custom filter on tenant id, platform will filter on tenant based on logged in user.

I assumed Andre wanted to add custom filter on the tenant id and hence I suggested to check "Show Tenant Identifier" on entity.


Hi André,

Please clarify it in more detail. so we can able to provide a required solution.

Thank you,



first all, check this documentation: How to Build a Multi-tenant Application


Nuno Verdasca


Please check the Application in the forge to get an idea of how to build a multi Tenant Application.


I hope it will help you to get an Idea of Multi-Tenant.

Thank you,