Multi tenant and Bootstrap the data

I have some set of predefined values which I want to be inserted or available to the application for each tenant which will be created in the application.

1.Shall I call the bootstrap action while creating the tenant
2.Can I use timer to run while creating the tenant.
3.I want to understand how to corelate the bootstrap action ,the timer functinality for a tetant which is going to be created to the system.
4.If I go with timer then how it is going to run for each new tenant which will be created on need basis.
Please suggest. 
Hi java,

1. If you are creating the tenant programmatically using TenantCreate you should use TenantSwitch to change tenant and call the bootstrap action afterwards. Probably you would then use the TenantSwitch action to go back to the tenant you were...
2. You can execute a multi-tenant timer. As you can see here the timer is executed once for each tenant meaning that your logic must be safe to be executed in a tenant that was created previously and for which the bootstrap action was already executed.

I would opt for option 1 in this case as it seems to be more controlled.
Hi Andre,

Thanks for the reply . 
Is this the correct understanding of  behaviour related to timer and tenant  :
1.Whenever a tenant is created irrespective of whether the tenant has created through service center or by any custom tenant creation UI (thorugh TenantCreate action) if there is timer set as 
  • Is Multi-tenant: yes then the timer will also be run and the corresponding data will be bootstraped to the application.
2.Once I make a entity as multi tenant and then realizes that the entity need not to be multitenant and I make that as non-multitenant then is there a implication or I can do it without experiencing any strange behaviour.

3.I noticed that the tenant_id coloumn still shows in the entity even if its not multitenant . Is there going to be problem in while executing the application queries.

1. When you have a timer that executes on 'When Published' schedule this timer will also be executed when a tenant is created, either throught Service Center or API (TenantCreate action).

2. If you set an entity as Multi-tenant: No after it already has data isolated by a tenant_id the consequence will be that you will have all the data visible, e.g., if you have a User entity as multi-tenant and you have user John in tenant 1 and 2, while this is multi-tenant a query over it would return only one John, for each tenant when you set it as not multi-tenant you would have two records returnd both named John. You will also have a warning indicating you have a Tenant_Id attribute in the database that is not present in the entity.

3. I think this is related with the information above, i.e., it's the warning you get in the TrueChange™ pane, right?
Hi Andre,

I have identified some entities which are non-multitenant but I published them as multitenant initialy. I am seeing Tenant_Id attribute in the database for those entities after I changed them to non-multitenant. Is there a way to get rid of Tenant_ID for these non-multitenant entities. 
Whether the Tenant_ID column for these non-multitenant entities will have any problem with existing application queries.

Please suggest.


You can use the DBCleaner_API to remove unused columns from those entities or you can go directly to the database, if you have access, and drop those columns. They have no impact on your queries.
Once you delete those columns if you rollback to a version in which the entity was multi-tenant the column will be re-created.
Hi Andre,
Really apprecited your answer.Thanks a lot.