Skip to content

$p.apiDeptsCreate

Overview

Creates a department via an Ajax POST request.

Syntax

JavaScript
$p.apiDeptsCreate({
    payload: {
        <Department information to create>
    },
    done: <Processing when API communication succeeds>,
    fail: <Processing when API communication fails>,
    always: <Processing when API communication completes>
});

Parameters

Parameter name Type Required Description
Department information to create object Specify the department information to create in JSON format.
Processing when API communication succeeds function Yes Processing to run when API communication succeeds.
Processing when API communication fails function Processing to run when API communication fails.
Processing when API communication completes function Processing to run when API communication completes.

Usage Examples

JavaScript
$p.apiDeptsCreate({
    payload: {
        DeptCode: "[Department code of the department to register]",
        DeptName: "[Name of the department to register]",
        Body: "[Description of the department to register]",
        ClassHash: {
            ClassA: "test-class-column"
        }
    },
    done: function (data) {
        console.log(data);
        console.log('The department information was created successfully.');
    },
    fail: function (data) {
        console.log('Failed to create department information.');
    },
    always: function (data) {
        console.log('Creation of department information has completed.');
    }
});

ClassHash

To set a value in an "Extended Column", specify the column name as a parameter.

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

Return Value

On normal completion, an object like the following is returned.

JavaScript
{
    "Id": 96,
    "StatusCode": 200,
    "Message": "\" [Name of the department to register] \" has been created."
}

Items of the Return Value

Item Description
Id ID of the created department
StatusCode Status code of the execution result
Message Execution result message

Supported Versions

Supported versions Description
1.5.8.0 or later Function added