Skip to main content

system.mes.personnel.savePerson

Description

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

Syntax

system.mes.personnel.savePerson(**person_data)

Parameters

ParameterTypeNullableDescription
departmentIdString (ULID)TrueThe ULID of the department this person is assigned to.
departmentNameStringTrueThe name of the department.
departmentPathStringTrueThe path of the department.
personStatusString (Enum)FalseThe status of the person (ACTIVE or INACTIVE). Default Value is ACTIVE
firstNameStringFalseThe first name of the person.
lastNameStringFalseThe last name of the person.
initialsStringTrueThe initials of the person.
usernameStringFalseThe username of the person.
idString (ULID)TrueThe ULID of the person (optional, used for updating an existing person).
notesStringTrueNotes related to the person.
enabledBooleanTrueIndicates if the person 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 person.

Code Examples

# Generate the object structure for a new person object, set the initial arguments and save it
person = system.mes.personnel.newPerson()
person['firstName'] = 'John'
person['lastName'] = 'Doe'
person['username'] = 'jdoe'
person['departmentId'] = '01JAP8R5RT-3FPXQABY-7KQZT6VF'
savedPerson = system.mes.personnel.savePerson(**person)