title: Tenant ID setting in case of "startBeforeActivity"
body: <p>ENV: Camunda 7.5</p>
  
  <p>Approach: <a href="https://docs.camunda.org/manual/7.5/user-guide/process-engine/multi-tenancy/#single-process-engine-with-tenant-identifiers" rel="nofollow">Single Process Engine With Tenant-Identifiers</a> with <a href="https://docs.camunda.org/manual/7.5/user-guide/process-engine/multi-tenancy/#transparent-access-restrictions-for-tenants" rel="nofollow">Transparent Access Restrictions for Tenants</a></p>
  
  <p>Given: <code>foo</code> is a process definition key which is deployed without tenant ID, i.e. shared process among all tenants. <code>bar</code> is the ID of a service task within <code>foo</code>.</p>
  
  <p>The <a href="https://docs.camunda.org/manual/7.5/user-guide/process-engine/multi-tenancy/#instantiate-a-shared-definition" rel="nofollow">TenantIdProvider</a> works well if one start process instances normally (<code>startXXX</code> or <code>startXXXByMessage</code>). For test cases which don't start process instances this way, rather with:</p>
  
  <p><code>runtimeService.createProcessInstanceByKey('foo')
                 .startBeforeActivity('bar')
                 .execute()</code></p>
  
  <p>the tenant ID doesn't get set. Maybe someone can point out why and how. Thanks!</p>