system.kanoa.cmms.updateWorkType(workTypeInfo, userId)
Updates an existing work type's full record (name, color, enabled status, and sort order).
Unlike updateWorkTypeField, this replaces the whole configurable record in one call so all keys in workTypeInfo are required, including fields that aren't changing.
Parameters
workTypeInfo Dictionary
| - enabled | Boolean | Not required. Defaults to True if not passed |
| - sortOrder | Integer | Not required. Defaults to 0 if not passed |
| - workTypeColor | String | Not required. i.e '#FF0000' |
| - workTypeId | Integer | Id of the work type to update |
| - workTypeName | String | Name of work type |
userId Integer:Id of the user executing the function
Returns
# of records modified Integer
message String None if success
Example
# Rename work type id 4 from "Design" to "Engineering" and change its color
workTypeInfo = {
"workTypeId": 4,
"workTypeName": "Engineering",
"workTypeColor": "#2E86C1",
"enabled": True,
"sortOrder": 4,
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
recordsModified, message = system.kanoa.cmms.updateWorkType(workTypeInfo, userId)
print recordsModified, message