The following code shows how to use the API service to create, read, update, and delete tenant groups using the ITenantGroup interface:

define variable group as ITenantGroup no-undo.

group = service:NewTenantGroup("CustGroup").
/* Set properties and optionally add elements to collections */
. . .
service:CreateTenantGroup(group).

. . .
group = service:GetTenantGroup ("ACMECustGroup").
/* Set properties and/or add/delete domain(s) */
. . .
service:UpdateTenantGroup(group).
. . .

service:DeleteTenantGroup("CustGroup").

It is also possible to retrieve a collection of tenant groups in the database from the service and then do create, read, update, and delete on tenants in the ITenantGroupSet collection before passing the collection to the service to be committed in a single transaction:

define variable groupSet as ITenantGroupSet no-undo.
define variable group    as ITenantGroup no-undo.

groupSet = service:GetTenants().
group = service:NewTenantGroup("ABCGroup").
/* Set properties and optionally add elements to collections */
. . .
groupSet:Add(group).
group = groupSet:Find("ABCCustomer")
group:Description = "ABCCustomer group.".
group = groupSet:Find("ABCOrder").
groupSet:Remove(group).
service:UpdateTenantGroups(groupSet).

For more information on the: