Skip to main content

system.kanoa.inventory.updatePart(partInfo, userId)

Updates an existing part record. Pass the part's id along with any of the updatable fields in partInfo (category, manufacturer reference, unit of measure, description, and the boolean handling flags) to overwrite the part's current values. Use updatePartField instead if you only need to change a single column.


Parameters

partInfo Dictionary

- defaultUomIdInteger
- enabledBoolean
- isConsumableBoolean
- isCriticalSpareBoolean
- isRepairableBoolean
- isSerializedBoolean
- manufacturerIdInteger
- manufacturerPartNumberString
- notesString
- partCategoryIdInteger
- partDescriptionString
- partIdInteger
- partNumberString

userId Integer:Id of the user executing the function


Returns

# of records modified Integer
message String None if success


Example

# Update the manufacturer reference and notes on an existing oil filter part
partInfo = {
'partId': 5231,
'partNumber': 'FLT-3000',
'partDescription': 'Spin-On Oil Filter, 3in Thread',
'partCategoryId': 9,
'manufacturerId': 18,
'manufacturerPartNumber': 'FRAM-PH3000',
'defaultUomId': 1,
'enabled': True,
'isConsumable': True,
'isCriticalSpare': False,
'isRepairable': False,
'isSerialized': False,
'notes': 'Updated cross-reference after supplier change'
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})

recordsModified, message = system.kanoa.inventory.updatePart(partInfo, userId)
print recordsModified, message