Type parameters
Hierarchy
- BaseItem<UserGroupData>
- ItemRef<UserGroupItem>
-
UserGroupItemRef
- UserGroupItem
Properties
Readonly code
App code of the URL’s target (the app’s code).
Readonly data
Values of object’s fields.
Readonly fields
Description of the object’s fields.
Readonly id
ID of the URL’s target.
Readonly namespace
Namespace of the URL target (the code of the workspace that the app belongs to).
Methods
addItem
-
The method adds users, org chart items, and groups to a user group.
Parameters
-
Rest ...children: (UserItemRef | UserGroupItemRef | OrganisationStructureItemRef)[]
Returns Promise<void>
-
delete
-
The method is used to delete user groups.
const group = await System.userGroups.search().where(f => f.__name.eq('Customer service employees (outdated)')).first(); const parentGroups = await group.parentGroups(); if (parentGroups && parentGroups.length === 0) { await group.delete(); }
Returns Promise<void>
fetch
-
Request complete data of a reference object.
Returns Promise<UserGroupItem>
normalize
-
Delete duplicate data in arrays.
The method deletes duplicates in fields that store arrays of links to system objects (users, files, app items, or documents). For example, you can call this method after bulk editing data within an object.
const app1 = await Context.data.app1.fetch(); const app2 = await Context.data.app2 .fetch(); app1.data.executors.push(app2.data.executors); app1.normalize(); // Now we need to go over the elements in the new array app1.data.executors .forEach( ... );
Returns void
parentGroups
-
The method obtains a list of groups that the current group is included in.
const parentGroups = await group.parentGroups();
Returns Promise<UserGroupItem[]>
positions
-
The method receives a list of positions included in a group.
const groupName = 'Workspace administrators'; const group = await System.userGroups.search().where(g => g.__name.eq(groupName)).first(); const positions = await group.positions();
Returns Promise<OrganisationStructureItem[]>
save
-
The method is used to save user groups.
const serviceEmployeesGroup = await System.userGroups.search().where(f => f.__name.eq('Service employees')).first(); await serviceEmployeesGroup.addItem(Context.data.new_employee); await serviceEmployeesGroup.save();
Returns Promise<void>
subGroups
-
The method returns all nested groups.
const group = await System.userGroups.search().where(f => f.__name.eq('Meeting participants')).first(); const subGroups = await group.subGroups();
Returns Promise<UserGroupItem[]>
users
-
The method returns users included in the group.
Parameters
-
Optional from: undefined | number
-
Optional size: undefined | number
Returns Promise<UserItem[]>
-
User group