Skip to main content

system.mes.shift.getShift

Description

Retrieves a Shifts record either by its ID, or by locationIdOrPath and name.

Syntax

system.mes.shift.getShift(id)
system.mes.shift.getShift(locationIdOrPath, name)

Parameters

Method 1: Get by ID

ParameterTypeNullableDescription
idStringFalseThe ID of the shift to retrieve.

Method 2: Get by Location and Name

ParameterTypeNullableDescription
locationIdOrPathStringFalseThe location ID or path where the shift is defined.
nameStringFalseThe name of the shift to retrieve.

Returns

Returns a JSON representation of the shift. Returns nothing if no shift is found.

NameTypeDescription
nameStringThe shift name.
descriptionStringDescription of the shift.
shiftScheduleNameStringThe name of the schedule defining this shift's timings.
shiftScheduleSourceStringThe source of the schedule (e.g., IGNITION_SCHEDULE, IGNITION_EXPRESSION).
locationIdString (ULID)The location where the shift runs.
locationPathStringThe path of the location (for display purposes).
currentRecordIdString (ULID)The current shift record id, if any.
runningConflictStrategyStringStrategy for conflicts (e.g., STOP_PREVIOUS, THROW_EXCEPTION).
startTriggerExpressionStringExpression used to determine when the shift should start.
startTriggerTypeStringTrigger type used to start the shift (e.g., RISING_EDGE, FALLING_EDGE, CHANGE).
stopTriggerExpressionStringExpression used to determine when the shift should end.
stopTriggerTypeStringTrigger type used to end the shift (e.g., RISING_EDGE, FALLING_EDGE, CHANGE).
idString (ULID)The ULID of the shift.
notesStringNotes related to the shift.
enabledBooleanIndicates if the shift is active and enabled.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional field for user-defined context.

Code Examples

# By ID
shift = system.mes.shift.getShift('01JAP8RJBN-8ZTPXSGY-J9GSDPE1')
print(shift)

# By location and name
shift = system.mes.shift.getShift('DairyCo/Plant1/Line1', 'Morning Shift')
print(shift)