Skip to main content

system.kanoa.cmms.addProcedureStepCheck(checkInfo, userId)

Adds a check to an existing procedure step identified by procedureStepId. Checks represent discrete verification points within a step (e.g. a measurement to record, a pass/fail inspection, or a value to confirm) that a technician must address while performing that step. As with procedure steps, sortOrder controls the order in which checks are presented within the step, and required marks whether the check must be satisfied before the step can be marked complete.

All checkInfo keys are required.

checkConfig is a complex dictionary object containing additional check information stored in the database as a string.


Parameters

checkInfo Dictionary

Can be None
- checkConfigString
- checkDescriptionString
- checkNameString
- enabledBoolean
- procedureStepIdIntegerId of procedure step
- requiredBoolean
- sortOrderInteger

userId Integer:Id of the user executing the function


Returns

procedureStepCheckId Integer
message String None if success


Example


checkConfig = {
'dataTypeId': '5',
'engUnitId': None,
'specInfo': {
'specType': 'setPoint',
'setPoint': {'operator': '>', 'value': 10},
'range': {'max': None, 'min': None},
'regex': {'value': ''},
'tolerance': {'tgt': None, 'lsl': None, 'usl': None, 'lel': None, 'lcl': None, 'ldl': None, 'udl': None, 'uel': None, 'ucl': None}
},
'pickListInfo': {
'pickListId': 8,
'pickListValues': {
'Fraction': {'max': None, 'increment': None, 'min': None},
'Text': {'WARNING': [], 'PASS': [], 'FAIL': [], 'NEUTRAL': [], 'multiSelect': False},
'Time': None,
'Number': {'max': None, 'increment': None, 'min': None},
'Tree': '',
'Barcode Scanner': {'script': None},
'Boolean': {'TRUE': ['Yes'], 'FALSE': ['No']
}
}
}
}

checkInfo = {
"procedureStepId": 45,
"checkName": "Belt tension reading",
"checkDescription": "Record the measured belt tension in Newtons.",
"checkConfig": system.util.jsonEncod(checkConfig),
"sortOrder": 1,
"required": True,
"enabled": True
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
procedureStepCheckId, message = system.kanoa.cmms.addProcedureStepCheck(checkInfo, userId)
print procedureStepCheckId, message