users.GetList
Overview¶
Get the information of multiple users in Server Script by specifying filter conditions, sort order, and paging.
Methods¶
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| view | string | Specify the filter and sort conditions as a JSON string. For details, see "JSON Data Layout: View". If omitted, all users are included. | |
| offset | int | The position to start getting from (0-based). Used for paging. For details, see "Offset" in "JSON Data Layout: Common". | |
| pageSize | int | The maximum number of users to get in one call. If 0 or a value greater than Api.PageSize (default 200) is specified, Api.PageSize is applied. For details, see "PageSize" in "JSON Data Layout: Common". |
Usage Examples¶
Basic Example (All Users, First 200)¶
const list = users.GetList();
context.Log(list.Length);
for (const item of list) {
var user = JSON.parse(item.ToString());
context.Log(user.UserId + ', ' + user.LoginId + ', ' + user.Name);
}
Example Specifying Filter, Sort Order, and Paging¶
const view = {
ColumnFilterHash: {
DeptId: '3',
Disabled: "false"
},
ColumnSorterHash: {
LoginId: 'asc'
}
};
// Get only the first 3 users
const list = users.GetList(JSON.stringify(view), 0, 3);
context.Log('Count: ' + list.Length);
Example of Keyword Search (SearchText)¶
const view = {
ColumnFilterHash: {
SearchText: 'Yamada'
}
};
const list = users.GetList(JSON.stringify(view));
Return Value¶
Returns an array of "user objects". For the layout of the object, see "Developer's Guide: Server Script: user". If there are no matching users, an empty array is returned (not null).
[
{
"TenantId": 1,
"UserId": 11,
"DeptId": 3,
"LoginId": "yamada",
"Name": "Taro Yamada",
"UserCode": "U0011",
"TenantManager": false,
"ServiceManager": false,
"Disabled": false,
"ClassHash": {
"ClassA": "test-class-column"
},
"ClassHash": {
"ClassA": "test-class-column"
},
"NumHash": {
"NumA": 100
},
"DateHash": {
"DateA": "2026-08-19"
},
"DescriptionHash": {
"DescriptionA": "Supplementary description"
},
"CheckHash": {
"CheckA": true
}
}
]
Cautions¶
This is a method used in "Server Script". It cannot be used in "Script".
Supported Versions¶
| Supported versions | Body |
|---|---|
| 1.5.8.0 and later | Added function |