Skip to main content

system.mes.shift.newShiftRecord

Description

Generates an empty non-persisted Shift Records object to provide the structure required by the API to save a new record into the database. Use with saveShiftRecord.

Syntax

system.mes.shift.newShiftRecord()

Parameters

ParameterTypeNullableDescription
None--This method does not take any parameters.

Returns

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

KeyDefault Value
startDatenull
endDatenull
statusIDLE
locationIdnull
locationPathnull
shiftIdnull
shiftNamenull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Create an empty Shift Record object
record = system.mes.shift.newShiftRecord()

# Populate fields (optional; many are set by start/stop methods)
record['shiftId'] = '01JAP8RJBN-8ZTPXSGY-J9GSDPE1'
record['locationId'] = '01JAP8RJBN-8ZTPXSGY-J9GSDPE1'

# Save the record
saved = system.mes.shift.saveShiftRecord(**record)
print(saved)