Skip to main content

system.kanoa.inventory.addSupplier(supplierInfo, userId)

Adds a new supplier record to the inventory system. The caller supplies a dictionary of supplier attributes (account number, contact details, and status) along with the id of the user performing the action for audit purposes. On success, the newly generated supplier id is returned; on failure, an error message is returned instead.


Parameters

supplierInfo Dictionary

- accountNumberString
- contactNameString
- emailString
- enabledBoolean
- phoneString
- supplierNameString
- websiteUrlString

userId Integer:Id of the user executing the function


Returns

supplierId Integer
message String None if success


Example

supplierInfo = {
'supplierName': 'Grainger',
'accountNumber': 'GRA-10492',
'contactName': 'Dana Whitfield',
'email': 'dana.whitfield@grainger.com',
'phone': '800-555-0142',
'websiteUrl': 'https://www.grainger.com',
'enabled': True
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
supplierId, message = system.kanoa.inventory.addSupplier(supplierInfo, userId)
print supplierId, message