Skip to content

depts.Create

Overview

Create a new "Department" from "Server Script". This is a method of the depts object.

Methods

depts.Create(dept);

Parameters

Parameter Description Required
dept Specify the department information to create as a JSON string. Yes

Usage Examples

The following example creates a new department.

const payload = {
    DeptCode: "D001",
    DeptName: "New Department",
    Body: "Description",
    Disabled: false,
    ClassHash: {
        ClassA: "test-class-column"
    }
};

const createok = depts.Create(JSON.stringify(payload));
context.Log(createok);

Return Value

Type Description
boolean Returns true if the department is created successfully, and false if it fails.

Specifying Values for Extended Columns

To set values for "Extended Column", specify the column name and value in ClassHash.

ClassHash: {
    ClassA: "test-class-column"
}

Supported Versions

Supported versions Body
1.5.8.0 and later Added function