Skip to main content
Multi-tenancy Customization Basics

How to customize multi-tenant environments.

Updated over a year ago

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.


Customization Basics

  • 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 TenantID field. This corresponds to the RecordID value 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 TenantID signed in. For example, if a user signed into the East franchisee, which has a TenantID of 2, they would only see Bob Crenshaw, Craig Crider, and John Smith in the Contacts app.

  • If a record has no TenantID specified, then it is considered global, and shown to everyone.


What values from session options are available?

  • MultiTenancy - Current Tenant - the current TenantID the user is currently signed into.

  • MultiTenancy - Permitted Tenants - the user's "Permitted Tenant List", a comma separated list of the TenantIDs this 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 TenantID exists on the screen, the new record will save using the TenantID the user signed in with.

  • If the record is an existing record and no TenantID field exists on the screen, then the original TenantID is preserved.

  • If a TenantID exists 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 TenantID field specified in the criteria builder, it will default to the TenantID the user signed in to. There is a default filter to only select records within the current Tenant.

  • If you specify a TenantID in your criteria builder, you will override the default filter. However, only records accessible in the user's Permitted Tenant List will show.

Example Scenario:

RecordID

Name

1

Head Office

2

Franchisee A

3

Franchisee B

4

Franchisee C

A method user, Mary, has been given access to everything except Franchisee C, which would be TenantID = 4 .

SCENARIO 1:

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.

SCENARIO 2:

"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 Name field.

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.

Did this answer your question?