Viewing and Editing Multi-tenant Data

In the realm of software development, particularly when providing services to multiple clients or user groups, the concept of multi-tenancy offers a strategic advantage. Multi-tenancy allows for the deployment of a single application instance serving various tenants, with each tenant’s data kept isolated and secure. This approach not only ensures data privacy but also optimises resource use, making it a cost-effective solution for businesses.

OutSystems, a leader in modern application development, offers robust multi-tenant capabilities, simplifying the development and management of such applications. This article delves into the nuances of viewing and editing multi-tenant data in OutSystems, as demonstrated by Senior OutSystems Developer Nigel Lamb in this Dev Tip video.

 

Setting Up Multi-tenant in OutSystems

The first step in managing multi-tenant applications in OutSystems is to configure your module for multi-tenancy. This is achieved by setting the ‘Multi-tenant’ property of the module to ‘Yes’. Once this setting is enabled, all entities created within this module automatically inherit the multi-tenant configuration. However, OutSystems provides the flexibility to alter this setting for individual entities, allowing some data to be shared across different tenants if required.

Viewing Multi-tenant Data

One of the key features of OutSystems is the ability to view data isolated to each tenant, directly from the Service Studio. When you access the data of a multi-tenant entity, such as ‘Fruit Type’ in Nigel’s example, you will initially see the data related to your current tenant. To view data from other tenants, OutSystems Service Studio offers a feature called ‘Configure Tenant to Test Queries’. By using this feature, developers can switch between different tenants and view their respective data without leaving the development environment.

Editing Entity Tenancy

In instances where you need to share common data across all tenants, such as general information about fruit types, you can configure an individual entity to be single-tenant. By setting the ‘Is Multi-tenant’ field to ‘No’ in the entity properties, the data becomes accessible to all tenants, thereby ignoring the tenant isolation typically enforced by multi-tenant settings.

Advanced Data Handling

For entities where tenant-specific identification is crucial, OutSystems allows the ‘Show Tenant Identifier’ option to be enabled. This option adds a ‘Tenant ID’ to the entity, making it visible in the data records. This feature is particularly useful for scenarios where data needs to be manually filtered by tenant, as it provides a clear identifier for developers to utilise in queries and data management.

Utilising Advanced SQL in Multi-tenant Applications

OutSystems also supports advanced SQL queries for multi-tenant applications. When executing an SQL query within the context of a multi-tenant application, the data returned will correspond to the currently selected tenant. This functionality ensures that all database operations respect tenant isolation, enhancing data security and integrity across the board.

Practical Demonstration

As highlighted in Nigel’s demonstration, viewing and editing multi-tenant data in OutSystems is streamlined and highly configurable. Developers can easily toggle between different tenants, adjust entity settings for specific data-sharing requirements, and utilize advanced SQL to manage data effectively across all tenants.

Conclusion

OutSystems’ multi-tenant capabilities provide a powerful framework for developers to manage multiple customer data securely and efficiently. By leveraging these features, businesses can deliver personalised experiences to their users while maintaining a high level of data isolation and security. Whether you are new to multi-tenancy or looking to refine your existing applications, OutSystems offers the tools and flexibility needed to succeed in a multi-tenant environment.

Want to learn more valuable Dev Tips? Sign up for our newsletter and stay updated with the latest insights! Also, don’t forget to check out our upcoming OutSystems courses to scale your career.