Skip to main content

system.kanoa.item.checkItemState

Description

checks if an itemState exists for the itemStateClassId and creates it if it doesn't

Syntax

checkItemState(itemStateName, itemStateClassId, itemStates, userId)
  • Parameters
      itemStateName (string)
      itemStateClassId (int)
      itemStates (dict)
      userId (int)
  • Returns
      itemStateId (int)
      itemStates (dict): updated dictionary if new item state created
      itemStatesUpdated (bool): True if itemStateName was not found and added to itemStates
      msg (string): None if success
  • Code Examples

    # Example Usage:
    itemStateName = 'Illegible label'
    itemStateClassId = 45
    itemStates = system.kanoa.utilities.convertDatasetToDict(system.kanoa.item.getItemStates({}), 'itemStateName', 'itemStateId')
    userId = 17
    retVal, msg = system.kanoa.item.checkItemState(itemStateName, itemStateClassId, itemStates, userId)