Skip to main content

Create department

Creates a new department

Function CreateDepartment(Val URL, Val Name, Val ParentID = "", Val HeadID = "", Val Token = "") Export

ParameterCLI optionTypeRequiredDescription
URL--urlStringURL of webhook or a Bitrix24 domain, when token used
Name--titleStringDepartment name
ParentID--parentidString, NumberID of parent department
HeadID--headidString, NumberID of department manager
Token--tokenStringAccess token, when app auth method used

Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API


tip

Method at API documentation: department.add


1C:Enterprise/OneScript code example
    URL = "https://b24-ar17wx.bitrix24.by/rest/1/yg2...";

Name = "Main department";
ParentID = 1;

Result = OPI_Bitrix24.CreateDepartment(URL, Name, ParentID);

URL = "b24-ar17wx.bitrix24.by";
Token = "2f4e4067006e9f06006b12e400000001000...";

Name = "Subordinate department";
ParentID = "1068";
HeadID = 1;

Result = OPI_Bitrix24.CreateDepartment(URL, Name, ParentID, HeadID, Token);
    oint bitrix24 CreateDepartment \
--url "b24-ar17wx.bitrix24.by" \
--title "Subordinate department" \
--parentid 1084 \
--headid 1 \
--token "***"
Result
{
"result": 594,
"time": {
"start": 1728454927.08955,
"finish": 1728454927.30747,
"duration": 0.217915773391724,
"processing": 0.186015844345093,
"date_start": "2024-10-09T09:22:07+03:00",
"date_finish": "2024-10-09T09:22:07+03:00",
"operating_reset_at": 1728455527,
"operating": 0.18598484992981
}
}