system.kanoa.cmms.updateWorkTypeField(workTypeId, field, value, userId)
Updates a single field on an existing work type record, identified by workTypeId, without requiring the full record to be supplied.
Useful for quick single-field edits such as renaming a work type or toggling its enabled state. field is checked against an allow-list of updatable columns; passing a field that isn't on that list returns an error rather than being applied.
Parameters
workTypeId Integer: Id of workType to update
field String: Valid options are workTypeName, workTypeColor, sortOrder, 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
# Disable the "Design" work type (id 4) without touching its other fields
workTypeId = 4
fieldToUpdate = "enabled"
newValue = False
userId = system.kanoa.security.getIDPUserId({"userName": 'SYSTEM'})
recordsModified, message = system.kanoa.cmms.updateWorkTypeField(workTypeId, fieldToUpdate, newValue, userId)
print recordsModified, message