Skip to main content

system.kanoa.cmms.updateWorkOrderField(workOrderId, field, value, userId)

Updates a single named field on an existing work order, identified by workOrderId, to the passed value. Call this when only one attribute needs to change � for example, bumping workOrderStatusId when a technician starts work, or reassigning assignedTo � without having to resend the entire work order dictionary as updateWorkOrder requires. userId is recorded for the audit trail (changedBy). Only the field names listed below are valid for the field argument.


Parameters

workOrderId Integer: Id of workOrder to update
field String: Valid options are title, description, assetId, procedureId, workOrderStatusId, workOrderPriorityId, maintenanceTypeId, scheduleTypeId, requestedBy, assignedTo, leadTimeDays, enabled
value String: Value to update to
userId Integer:Id of the user executing the function


Returns

# of records modified Integer
message String None if success


Example

# Mark a work order for HVAC-Unit-7 as "In Progress" once a technician starts the job
workOrderId = 6104
field = "workOrderStatusId"
value = 2
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})

recordsModified, message = system.kanoa.cmms.updateWorkOrderField(workOrderId, field, value, userId)
print recordsModified, message