Skip to main content

system.kanoa.inventory.updatePartCategoryField(partCategoryId, field, value, userId)

Updates a single named field on a part category record identified by partCategoryId. Use this function when only one column needs to change (for example, renaming a category or toggling its enabled flag) instead of passing a full partCategoryInfo dictionary to updatePartCategory. The field parameter must be one of the valid column names for the part category table, and value is supplied as its string representation.


Parameters​

partCategoryId Integer: Id of part category to update
field String: Valid options are categoryName, parentPartCategoryId, 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​

# Bump the sort order of the "Electrical" part category
partCategoryId = 15
fieldName = 'sortOrder'
newValue = '4'
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})

recordsModified, message = system.kanoa.inventory.updatePartCategoryField(partCategoryId, fieldName, newValue, userId)
print recordsModified, message