Adding department automatically

Adding department automatically

Hello!

As far as I know, Service Desk API can't add departments.
Can I add departments directly throught DB?
I use queries:

SELECT MAX(CIID) + 1 FROM CI;
INSERT INTO CI (CIID, CITYPEID) VALUES (...);
INSERT INTO BaseElement (CIID) VALUES (...);
INSERT INTO DepartmentCI (CIID) VALUES (...);
INSERT INTO DepartmentDefinition (DEPTID, DEPTNAME, CIID) VALUES (...);

This creates the department. But when I try to open a department error occurs (HTTP Status 500).
After editing of any department the error disappears and everything is working fine.

Can I add department to service desk plus automatically?

Thanks in advance.

                  New to ADSelfService Plus?