Multi-Tenancy and Processes

  

Hi

Im currently developing a multi-tenancy application, which has isolated processes by tenant. Although the segregation works well with Entities, whenever I have a new entry in a trigger entity (with the correct tenant id), the business process / activity is under the default tenant (users). The intended behavior is that the process would be run on the respective tenant.

I tried to find and existing information on this topics but couldnt find anything. 


Cheers

Rene

Hi Rene,

In the System espace, you have access to a function TenantSwitch:

When your process fires off, you should use this function to TenantSwitch to the correct tenant, based on the TenantId on the record you are processing by passing the TenantId into the input parameter of this function.

Let me know if you have any issues,

Justin

Actually, if the entity is multi-tenant and the module with the process is using the same User Provider the process/activity should have been already running with the correct tenant, without the need of doing a explicit tenant switch.

Does your module have the entity imported with show tenant id? (Is it blue or red? To have the wanted behavior it should be blue)


Regards,

João Rosado

Thanks a lot for the reply Justin. TenantSwitch worked fine in my case.


Hi Joao

Its red. Just to give you an overview of the process: we have a generic email, to which users can send information. based on the email, we determine the tenant and write a record into a table with the respective tenant id. This is then the trigger for another process (the actual business process). And on this one the processes was always under the standard tenant, although the data were displayed under the correct tenant (but all actives in the epa toolbox where not). The as mentioned, the tenant switch solved it.

The "Red" tables should be avoided to fully take advantage of the platform multitenant features. Otherwise you will end up making a lot of work. They are only recommended for backoffice applications where it needs to see information for all tenants.

A more appropriate workflow there would be:

 - A non-multitenant entity with information with the email - tenant mappings
 - Receive the email
 - Do a switch tenant
 - Write the data on the multitentant entity (without the "Show Tenant Identifier", so its "Blue")
 - The process will automatically be triggered on the correct tenant.


Regards,
João Rosado