depts.Get
Overview¶
Get the information of one department by specifying the department ID in Server Script.
Methods¶
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| deptId | long | Yes | Specify the department ID to get. |
Usage Examples¶
const dept = depts.Get(2);
if (dept) {
context.Log(dept.DeptCode + ', ' + dept.DeptName);
} else {
context.Log('The department does not exist.');
}
Return Value¶
Returns the "dept object". For the layout of the object, see "Developer's Guide: Server Script: dept". If no department exists with the specified ID, null is returned.
{
"TenantId": 1,
"DeptId": 2,
"DeptCode": "D001",
"DeptName": "New Department",
"Body": "",
"Disabled": false,
"ClassHash": {
"ClassA": "test-class-column"
},
"NumHash": {
"NumA": 100
},
"DateHash": {
"DateA": "2026-08-19"
},
"DescriptionHash": {
"DescriptionA": "Supplementary description"
},
"CheckHash": {
"CheckA": true
}
}
Columns you cannot view
From version 1.5.10.0, the values of columns that the user running the server script cannot view are null (the properties themselves remain). By default, only tenant managers can view Disabled. Extended columns that the user cannot view are not included in ClassHash and the other hashes.
You can change which columns can be viewed in Column.json. For details, see "Extended Column".
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 the ability to get the values of extended columns |
| 1.5.10.0 and later | Changed the values of columns that the user cannot view to null |