Skip to main content

system.mes.personnel.newPerson

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

Syntax

system.mes.personnel.newPerson()

Parameters

ParameterTypeDescription
None-This method does not take any parameters.

Returns

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

KeyDefault Value
departmentId""
departmentNamenull
departmentPathnull
personStatusACTIVE
firstName""
lastName""
initials""
username""
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

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

# Set basic attributes for the new person
person['firstName'] = ''
person['lastName'] = ''
person['initials'] = ''
person['username'] = ''
person['departmentId'] = ''
person['personStatus'] = 'ACTIVE'
# (You can continue setting other properties as needed here)

# Save the new person to the system
savedPerson = system.mes.personnel.savePerson(**person)

# Output the JSON representation of the saved person
print(savedPerson)