Create a MultiTenant application

Comment: As of WorkWithPlus for Web 14 Upgrade #1, WorkWithPlus for Web supports a simple way of creating MultiTenant applications, with several benefits and automatic behaviours. You can read about this feature in the following link.

If you are using previous WorkWithPlus for Web versions, you can develop an application Multi-tenant performing a series of steps, in which we will achieve that the Company transaction is associated with all the others.

Create a transaction called Company, with PK CompanyId and a name attribute called CompanyName as in the following image:

MultiTenantApplication1

Next, we search the SDT WWPContext and add CompanyId with Type: Attribute:CompanyId:

MultiTenantApplication2

Now, open WorkWithPlus (Settings) > Transaction template > Transaction, add a rule inside 'Attribute based rules' called 'SetCompany':

MultiTenantApplication2.5

With these properties:

MultiTenantApplication3

 


The following steps will be applied to the Selection template, but you can apply it to the other templates that are inside the Transaction template (Main), depending on the needs of your application.

 

 

Go to WorkWithPlus (Settings) > Transaction template > Selection and write the properties as in the following image:

MultiTenantApplication4

Load:

LoadWWPContext(&WWPContext)
&CompanyId = &WWPContext.CompanyId

 

Now we must define some automatic conditions so that it can really be filtered by CompanyId:

MultiTenantApplicationAutomaticCondition

 

In Variables (not included in Web Form) parameter add CompanyId as variable.

MultiTenantApplicationReportParameter

 

Once these changes are made, when saving WorkWithPlus (Settings), do 'Update instances' to update all Transactions and Selections.

MultiTenantApplication7

 

Now it is necessary to add CompanyId in transactions that do not have it, change it to primary key so that a composite key is formed. Remember set 'Show in Default Form' = False.

MultiTenantApplication8
 

 

 

For everything to make sense, in the application login you should load the variable & WWPContext with & CompanyId, you can bring the data from GAM (using Extenibility of GAM) or by creating a new transaction which is inferred from the GUID of GAM and CompanyId.

 

As of WorkWithPlus for Web 14 Upgrade #1 see the following documentation: Multitenant Applications.