Skip to main content

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

- enabledBooleanNot required. Defaults to True if not passed
- sortOrderIntegerNot required. Defaults to 0 if not passed
- workTypeColorStringNot required. i.e '#FF0000'
- workTypeIdIntegerId of the work type to update
- workTypeNameStringName 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