WorkWithPlus supports a simple way of creating Multitenant applications, with several benefits and automatic behaviors.
In WorkWithPlus> General Settings, you make right-click over the main node Settings > add MultiTenant:
You need to set the value to the properties:
- Tenant Attribute: is the Primary Key Attribute of the Tenant transaction. The Attribute that, if present in a Transaction, will be considered the Tenant identifier.
- Tenant Description Attribute: Attribute that will be considered the Tenant Description (for displaying in Admin View).
- Get Tenant Description Expression: Expression to get the 'Tenant Description Attribute' value using a variable based on the 'Tenant Attribute' when the 'Tenant Description Attribute' is not present in the Transaction. e.g.:GetTenantDescription(&TenantId).
- Current Tenant Expression: a one-line expression, that returns the current Tenant, to be used in conditions of generated objects. In the example above, the information of the current tenant is saved in the context, using the WWPContext SDT.
- Supports all tenants view by default: Support an administrator to visualize the records from all tenants.
In each transaction instance (can be a Transaction that has WorkWithPlus applied, a Web Panel based on a List template or View template and based on a transaction, etc), in the 'General Properties' section, you will visualize a property named 'Multi-Tenant Support'
The possible values of this property are '<default>', 'True' or 'False':
- <default>: it will add the Multi-tenant behavior to the instance's objects if the transaction has as the first Primary Key attribute, the attribute defined in WorkWithPlus> General Settings > MultiTenant > Tenant Attribute.
In the example below, Person transaction has it, so with <default> value it will include the Multi-tenant behavior:
- True: it will add the Multi-tenant behavior to the instance's objects.
- False: it won't add the Multi-tenant behavior to the instance's objects.
When you have a Multi-tenant application set in the WorkWithPlus Settings (have the node 'MultiTenant' mentioned before), the attribute set in 'Tenant Attribute' won't be added automatically in any instance.
When an instance has its 'Support Multi tenant' property as True or <default> accomplishing the conditions mentioned before, WorkWithPlus will automatically:
- Remove 'TenantId' from the Parm Rule and assign it directly in the Rules, using the expression mentioned in WorkWithPlus > General Settings> Settings > MultiTenant > Property 'Current Tenant Expression':
- Add the Condition to filter the records from the current TenantId in the List objects:
- Add the Condition to filter the records from the current TenantId in the GridTab objects:
- In the View Object, get the information of the current record, filtering also by the TenantId.
Also, all the built-in features of WorkWithPlus will use the tenant information (filtering or assigning the tenant when needed), for example:
- Search Module (will display only the results from the current tenant)
- Auditing
- Import Excel & CSV
- Discussions Module
- Notifications and Subscriptions Module (the support of Multitenant for this feature will be included soon)
You can watch a webinar where this feature is shown in detail in the following links:
Note: this feature is available in WorkWithPlus for Web 14 Upgrade #1 or higher.
|