Set Tenant

Set Tenant actions are used to assign a record or a session to a tenant other than the default tenant.


For this action to have any affect on the system multitenancy must be enabled for the application.

By default a record is assigned to the tenant of the user that was logged, or session, in when the record was created therefore most of the time a set tenant action is unnecessary. The exception to this is when creating administrative screens that would allow for the creation of records in other tenants or on a registration page when a new tenant and user are being created at the same time.

The tenant id of the tenant is used to assign the record to a tenant. The tenant id is stored as a field on the tenant record.

Example: Suppose you want to have a registration page that will create both the new tenant record and a new user record as the same time. On the form that creates the user record you should add a set tenant action that will read the tenant id from the tenant that the page is about, the tenant is automatically assigned to the correct tenant. Then after the user logs in with their new credentials or after a Change User action is performed the user will only see records that were either assigned to the tenant or were created by users of that tenant.


Note: Some of these mechanics have been altered as of Platform Version 15.07.1115

Set Tenant For

Select what the tenant id will be assigned to

  • A Set of Records
  • The Authenticated User's Session. With this option you are temporarily changing the Tenant for the Authenticated User for this session only. Logging out, and back in will result in that User seeing their assigned Tenant's data.

Record to assign tenant

This is a query that locates the record(s) that will be assigned to the tenant. (Option only available when setting the Tenant for a Set of Records.)

Tenant id to assign

This is an expression that can be used to either look up the tenant id from a tenant record or assign it to a tenant using a fixed id.

Describe this action

Useful as a comment, this description will overwrite the automatically generated description in the Action Manager.

Queue this action and children

When an action is queued, the subsequent actions continue to process without it. Meanwhile, the queued action and its children process separately. Queue actions that you don't want a user to wait for.

action type - set tenant.txt · Last modified: 2016/09/14 18:19 (external edit)
Copyright WorkXpress, 2023