Skip to main content

system.mes.shift.validateShiftRecord

Description

Validates the specified parameters for a Shift Records record and returns any validation errors. This only checks if the object can be saved based on the attributes given.

Syntax

system.mes.shift.validateShiftRecord(**record_data)

Parameters

ParameterTypeNullableDescription
locationIdString (ULID)FalseThe ULID of the location where the shift runs.
shiftIdString (ULID)FalseThe ULID of the shift configuration this record belongs to.
startDateDateTimeTrueActual start date/time when the shift began.
endDateDateTimeTrueActual end date/time when the shift ended.
statusString (Enum)FalseCurrent status (IDLE, ACTIVE, CLOSED, VERIFIED).
idString (ULID)TrueThe ULID of the shift record.
notesStringTrueNotes related to the record.
enabledBooleanTrueIndicates if the record is active and enabled. Default true.
spare1StringTrueAdditional field for user-defined context.
spare2StringTrueAdditional field for user-defined context.
spare3StringTrueAdditional field for user-defined context.

Returns

Returns a JSON object where keys are field names and values are lists of validation violation messages.

Code Examples

rec = system.mes.shift.newShiftRecord()
rec['status'] = None # invalid (required)
violations = system.mes.shift.validateShiftRecord(**rec)
print(violations)