Description:
When multi-tenancy is installed, custom tables that have not been modified with regards to tenancy, possibly because they are unmanaged, are classified as "Untenanted".
This document describes how to change an unmanaged untenanted custom table from a tenancy type of "Untenanted" to a tenancy type of either "Tenant Required" or "Tenant Optional".
Solution:
Custom tables may be created using Web Screen Painter (WSP) or not. Tables created via WSP are managed tables. A table created manually that has its own .sch and .mod file is an unmanaged table.
The Schema Designer in WSP can be used to view published table definitions. The "Table Type" field indicates whether or not a table is a "Managed Table" or an "Unmanaged Table". In tenanted installations, the "Tenancy Type" field indicates whether a table is "Untenanted", "Tenant Optional", or "Tenant Required".
The "Tenancy Type" for unmanaged tables is "Untenanted" unless the table has been modified accordingly:
For example, a custom unmanaged table called test2 has only one column defined called col1. The schema file for the table, ztest2.sch in $NX_ROOT\site\mods, contains only:
#include "../schema.mac" #include "../bop.mac" TABLE ztest2 { id INTEGER UNIQUE KEY; last_mod_dt LOCAL_TIME; last_mod_by UUID REF ca_contact; col1 INTEGER; } p1 ztest2 -> CURR_PROV ztest2;
The corresponding object file in $NX_ROOT\site\mods\majic is ztest2.mod and contains only:
OBJECT ztest2 { ATTRIBUTES ztest2 { col1 INTEGER; last_mod_dt DATE { ON_CI SET NOW; }; last_mod_by SREL cnt { ON_CI SET USER; ON_NEW DEFAULT USER; }; }; FACTORY ztest2 { STANDARD_LISTS { MLIST OFF; RLIST OFF; }; REL_ATTR id; }; };
After adding the tenant column, ztest2.sch contains:
#include "../schema.mac" #include "../bop.mac" TABLE ztest2 { id INTEGER UNIQUE KEY; last_mod_dt LOCAL_TIME; last_mod_by UUID REF ca_contact; tenant UUID REF ca_tenant; col1 INTEGER; } p1 ztest2 -> CURR_PROV ztest2;
After adding TENANT_REQUIRED to the object file, ztest2.mod contains:
OBJECT ztest2 { ATTRIBUTES ztest2 { TENANT_REQUIRED; col1 INTEGER; last_mod_dt DATE { ON_CI SET NOW; }; last_mod_by SREL cnt { ON_CI SET USER; ON_NEW DEFAULT USER; }; }; FACTORY ztest2 { STANDARD_LISTS { MLIST OFF; RLIST OFF; }; REL_ATTR id; }; };
Within the WSP Schema Designer, click on Save and Publish. If this function is grayed-out, make an insignificant change to ztest2 within WSP such as adding a blank space to the Description field; Save and Publish should then be available.
Shutdown the Service Desk service. Issue pdm_publish. Restart the Service Desk service.
To verify the change, open Schema Designer in WSP. The "Tenancy Type" for ztest2 should now show that it is set to "Tenancy Required" rather than "Untenanted". See figure 1 below.
Figure 1.
<Please see attached file for image>