Skip to content

$p.apiDeptsUpdate

Overview

Updates a department via an Ajax POST request.

Syntax

JavaScript
$p.apiDeptsUpdate({
    id: <ID of the department to update>,
    data: {
        <Department information to update>
    },
    done: <Optional Processing>,
    fail: <Optional Processing>,
    always: <Optional Processing>
});

Parameters

Parameter name Type Required Description
id long Yes ID of the department to update
data object Specify the department information to update in JSON format. See the note below.
done function Yes Processing to run when API communication succeeds
fail function Processing to run when API communication fails
always function Processing to run when API communication completes

For the department information to update, set the same parameters as Update Dept API. Refer to the linked manual page and set the parameters.

Usage Examples

$p.apiDeptsUpdate({
    id: 2,
    data: {
        DeptName: '[Department name after the update]',
        ClassHash: {
            ClassA: 'test-class-column'
        },
        NumHash: {
            NumA: 100
        },
        DateHash: {
            DateA: '2026-08-19'
        },
        DescriptionHash: {
            DescriptionA: 'Supplementary description'
        },
        CheckHash: {
            CheckA: true
        }
    },
    done: function (data) {
        console.log(data);
        console.log('The department information was updated successfully.');
    },
    fail: function (data) {
        console.log('Failed to update department information.');
    },
    always: function (data) {
        console.log('Update of department information has completed.');
    }
});

Return Value

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

{
    "Id": 2,
    "StatusCode": 200,
    "Message": "\" [Department name after the update] \" has been updated."
}

Items of the Return Value

Item Description
Id ID of the updated 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

$p.apiDeptsGet
Developer's Guide: Script: $p.apiDeptsCreate
Developer's Guide: Script: $p.apiDeptsDelete
Developer's Guide: JSON Data Layout: Dept