Skip to main content

system.kanoa.operators.addOperatorShiftAssignment(assignmentInfo, userId)

Assigns a single operator to a shift by inserting one sch.operatorShiftAssignment row. Use this for an individual assignment not generated from a crew - see assignCrewToShift for assigning an entire crew.


Parameters

assignmentInfo Dictionary

- assetIdIntegerNot required. Ignored if shiftId is supplied (assetId is then resolved from sch.shift)
- endDateString
- shiftIdIntegerNot required. The sch.shift this assignment is tied to
- startDateString
- userIdIntegerThe sec.user being assigned

userId Integer: The user performing this action (createdBy)


Returns

operatorShiftAssignmentId Integer the new assignment's id on success, None on failure
message String None on success, an error message on failure


Example

assignmentInfo = {'userId': 5, 'assetId': 4, 'startDate': system.date.now(), 'endDate': None}
userId = 12
rowsAffected, message = system.kanoa.operators.addOperatorShiftAssignment(assignmentInfo, userId)