Skip to main content

system.kanoa.performanceState.checkPerformanceState(performanceStateName, performanceStateClassId, performanceStates, userId)

Checks if an performanceState exists for the performanceStateClassId and creates it if it doesn't


Parameters​

performanceStateName String: Name
performanceStateClassId Integer: Class
performanceStates Dictionary: Dictionary of performance states to check
userId Integer: Id of user executing the function


Returns​

performanceStateId Integer
performanceStates Dictionary updated dictionary if new item state created
performanceStatesUpdated Boolean True if performanceStateName was not found and added to performanceStates
msg String None if success


Example​

userId = 5
performanceStateName = 'Speed Loss'
performanceStateClassId = 4
performanceStates = system.kanoa.utilities.convertDatasetToDict(system.kanoa.performanceState.getPerformanceStates({}), 'performanceStateName', 'performnceStateId')
performanceStateId, performanceStates, performanceStatesUpdated, msg = system.kanoa.performanceState.checkPerformanceState(performanceStateName, performanceStateClassId, performanceStates, userId)