Customizing a multi-tenant environment requires an advanced knowledge of how customization works in Method.
In most cases, franchisors will initially get set up with the help of a 3rd party Method Solution Provider, or work with our customization team directly. However, if you are technically savvy and have the necessary time, you can take on this customization yourself.
In this article, we cover:
The Tenant table stores each company account in the multi-tenancy environment.
The Name field in the Tenant table corresponds to the company account name for the head office or franchisee.
All other tables have a
TenantIDfield. This corresponds to the
RecordIDvalue in the Tenant table.
For example, if a head office has zero customers and three franchisees, and the franchisees have three customers each, there will be nine customers in the Customer table. The Tenant and Customer table might look like this:
Note that John Smith appears twice, but that's because this customer is in two franchisee locations, East (
TenantID = 2) and West (
TenantID = 3).
All dropdowns, grids, reports, and calendars are automatically filtered to limit the data to only show records relating to the
TenantIDsigned in. For example, if a user signed into the East franchisee, which has a
TenantIDof 2, they would only see Bob Crenshaw, Craig Crider, and John Smith in the Contacts app.
If a record has no
TenantIDspecified, then it is considered global, and shown to everyone.
What values from session options are available?
MultiTenancy - Current Tenant- the current
TenantIDthe user is currently signed into.
MultiTenancy - Permitted Tenants- the user's "Permitted Tenant List", a comma separated list of the
TenantIDsthis user has been given access to.
How does filtering work?
By default, objects will show only the records that have no
TenantID or that match the
TenantID the user signed in with.
However, if you apply a filter that specifies the
TenantID in any way, then your filter will override the default filter. Keep in mind that regardless of which filter you apply, records will still be limited to their Permitted Tenant List.
How does saving work?
If you execute a Save All action on a screen when creating or editing a record:
If the record is a new record and no
TenantIDexists on the screen, the new record will save using the
TenantIDthe user signed in with.
If the record is an existing record and no
TenantIDfield exists on the screen, then the original
TenantIDexists on the screen, it is used as an override.
Be careful when switching an existing record between different franchisees for QuickBooks tables. It is not possible to move a record that has been synced with QuickBooks to a different franchisee without causing a conflict.
How does Retrieve value from a Table work?
If there is no
TenantIDfield specified in the criteria builder, it will default to the
TenantIDthe user signed in to. There is a default filter to only select records within the current Tenant.
If you specify a
TenantIDin your criteria builder, you will override the default filter. However, only records accessible in the user's Permitted Tenant List will show.
A method user, Mary, has been given access to everything except Franchisee C, which would be
TenantID = 4 .
Mary signs into Franchisee A (
TenantID = 2 ). She wants to retrieve a value from the Customer table, and specifies
TenantID Greater Than Number Zero .
This will retrieve all the records in the customer table, EXCEPT for any customer that has a
TenantID of 4, because Mary does not have access to
TenantID = 4 . It is not in her Permitted Tenant List.
"Anna Smith" is a customer, and belongs to Franchisee B, (
TenantID = 3 ).
Mary, again, signs into Franchisee A (
TenantID = 2 ).
Mary attempts to Retrieve Values from Table, searching for any record that contains "Anna Smith" in the
Note that there is no
TenantID specified as a condition, so in this case, Anna Smith will not be retrieved. Why? Because Mary is in Franchisee B, and Anna Smith is in Franchisee A, and there is an automatic filter to only search the Tenant that Mary is currently in.
In order to retrieve Anna Smith, Mary would have had to override the default filter and specify
TenantID > 0 . The image below would return Anna Smith's record.