Skip to main content

system.mes.personnel.newDepartment

Description

Generates an empty non-persisted Personnel Department object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveDepartment method in order to persist the record.

Permissions

This method does not require any permissions.

Syntax

system.mes.personnel.newDepartment()

Parameters

ParameterTypeDescription
None-This method does not take any parameters.

Returns

Returns a JSON representation of the newly created department object. The following is a list of keys and default values:

KeyDefault Value
namenull
descriptionnull
pathnull
parentIdnull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new department object with no initial arguments
department = system.mes.personnel.newDepartment()

# Set basic attributes for the new department
department['name'] = 'Engineering'
# (You can continue setting other properties as needed here)

# Save the new department to the system
saved_department = system.mes.personnel.saveDepartment(**new_department)

# Output the JSON representation of the saved department
print(saved_department)