Use current tenantId in timer

Use current tenantId in timer

  

Hi All,


is it possible to use the current TenantId in timer (tenant id of which the timer is run under).

In the action I could access Site.TenantId, but is it accessible if I run it as timer's action?


Thanks,
Daniel

Hi Daniel,

You can set an option in the Timer for Multi-Tenant, on this way the timer will execute for all tenant. 

If you wanna execute only specific tenant, you will need to use the action TenantSwitch, if you don't use that action the timer will run to default tenant.


About site variables, you have access but you need take care when they are site variables multi-tenant.



Regards

Paulo Ricardo

Yes Daniel You can access Site.TenantId under timer action.


Regards

-SK-

Solution

Hi Daniel,

As Shashi as said, you can use Site.TenantId in the Timer action to know in which tenant the Timer action is running.

But you also have two situations:

  • If the timer is set to mutltitenant then it will run in all tenants
  • If the timer is set to not multitenant then it will only run in the default tenant.

In both situations you can use the Site.TenantId.

And in both situations you can also (if you need to) use the TenantSwitch to switch to another tenant.

Cheers,

José

Solution

Awesome. Thanks a lot for the reply you all Guys.

José Costa wrote:

Hi Daniel,

As Shashi as said, you can use Site.TenantId in the Timer action to know in which tenant the Timer action is running.

But you also have two situations:

  • If the timer is set to mutltitenant then it will run in all tenants
  • If the timer is set to not multitenant then it will only run in the default tenant.

In both situations you can use the Site.TenantId.

And in both situations you can also (if you need to) use the TenantSwitch to switch to another tenant.

Cheers,

José

Hi Jose,

if I have 2 tenants, A and B. And I set the timer to multitenant.

when the timer is run in Tenant A, Site.TenantId will return Tenant A's Id. Is that correct?

the same when it is run in Tenant B, it will return Tenant B's Id.


Thanks,
Daniel