Skip to main content

system.kanoa.inventory.updateInventoryTransactionField(inventoryTransactionId, field, value, userId)

Updates a single named field on an existing inventory transaction to the given value. Unlike addInventoryTransaction, this function does not recompute or adjust the inventory balance � it is intended for correcting metadata (cost, references, notes) on a transaction after the fact, not for changing quantity or type. Use addInventoryTransaction for any change that should affect the inventory balance.


Parameters

inventoryTransactionId Integer: Id of inventory transaction to update
field String: Valid options are unitCost, assetId, supplierId, costCenterId, referenceType, referenceNumber, notes
value: Object: Value to update to
userId Integer:Id of the user executing the function


Returns

# of records modified Integer
message String None if success


Example

inventoryTransactionId = 5821
field = 'unitCost'
value = 4.50
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})

recordsModified, message = system.kanoa.inventory.updateInventoryTransactionField(inventoryTransactionId, field, value, userId)
print recordsModified, message