Skip to main content

system.mes.personnel.saveDepartment

Description

Creates or updates a Personnel Department record in the system based on the provided parameters.

Syntax

system.mes.personnel.saveDepartment(**department_data)

Parameters

ParameterTypeNullableDescription
nameStringFalseThe name of the department.
descriptionStringTrueThe description of the department.
pathStringTrueThe path to the department.
parentIdString (ULID)TrueThe ULID of the parent department to this department.
idString (ULID)TrueThe ULID of the department (optional, used for updating an existing department).
notesStringTrueNotes related to the department.
enabledBooleanTrueIndicates if the department is active and enabled.
spare1StringTrueAdditional field for user-defined context.
spare2StringTrueAdditional field for user-defined context.
spare3StringTrueAdditional field for user-defined context.

Returns

Returns a JSON representation of the saved department.

Code Examples

# Generate the object structure for a new department object, set the initial arguments and save it
department = system.mes.personnel.newDepartment()
department['name'] = 'Engineering'
savedDepartment = system.mes.personnel.saveDepartment(**newDepartment)