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:
Next, we search the SDT WWPContext and add CompanyId with Type: Attribute:CompanyId:
Now, open WorkWithPlus (Settings) > Transaction template > Transaction, add a rule inside 'Attribute based rules' called 'SetCompany':
With these properties:
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:
Load:
LoadWWPContext(&WWPContext)
&CompanyId = &WWPContext.CompanyId
Now we must define some automatic conditions so that it can really be filtered by CompanyId:
In Variables (not included in Web Form) parameter add CompanyId as variable.
Once these changes are made, when saving WorkWithPlus (Settings), do 'Update instances' to update all Transactions and Selections.
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.
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.
|