Skip to main content

system.kanoa.cmms.addWorkOrderEventTechnician(workOrderEventTechnicianInfo, userId)

Logs a technician (and the time they spent) against a specific work order event. This is how multiple technicians are recorded against the same work order event. Call this once per technician, each with their own durationMinutes and, optionally, workTypeId. All keys in workOrderEventTechnicianInfo are required unless otherwise stated as this function does not perform a partial insert. Rows are removed automatically if their parent work order event is deleted (ON DELETE CASCADE), so this doesn't need to be done manually when calling deleteWorkOrderEvent.


Parameters

workOrderEventTechnicianInfo Dictionary

- durationMinutesIntegerHow long the technician worked, in minutes
- userIdIntegerId of the technician who worked it (not the caller � see the trailing userId argument below)
- workOrderEventIdIntegerId of the work order event worked
- workTypeIdIntegerNot required. The kind of work performed (Design, Repair, ...)

userId Integer:Id of the user executing the function


Returns

workOrderEventTechnicianId Integer
message String None if success


Example

# Log 90 minutes of repair work against work order event 4521
workOrderEventTechnicianInfo = {
"workOrderEventId": 4521,
"userId": 12,
"workTypeId": 2,
"durationMinutes": 90,
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
workOrderEventTechnicianId, message = system.kanoa.cmms.addWorkOrderEventTechnician(workOrderEventTechnicianInfo, userId)
print workOrderEventTechnicianId, message