Skip to main content

system.kanoa.cmms.addProcedureStep(procedureStepInfo, userId)

Adds a single step to an existing procedure identified by procedureId. Steps represent the individual actions a technician performs while executing a procedure (e.g. "Inspect belt tension", "Lubricate bearings"), and sortOrder determines the sequence in which steps are presented during procedure execution. The required flag marks whether the step must be completed (and, presumably, cannot be skipped) before the procedure can be considered finished, and estimatedMinutes supports scheduling/duration estimates for the overall procedure. All procedureStepInfo keys are required.

stepConfig is a complex dictionary object containing additional step information stored in the database as a string.


Parameters

procedureStepInfo Dictionary

Can be None
- enabledBoolean
- estimatedMinutesInteger
- procedureIdIntegerId of procedure
- requiredBoolean
- sortOrderInteger
- stepConfigString
- stepDescriptionString
- stepNameString

userId Integer:Id of the user executing the function


Returns

procedureStepId Integer
message String None if success


Example

userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})

stepConfig = {
'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']
}
}
}
}

procedureStepInfo = {
"procedureId": 12,
"stepName": "Inspect belt tension",
"stepDescription": "Visually inspect the conveyor belt for proper tension and signs of wear.",
"stepConfig": system.util.jsonEncode(stepConfig),
"sortOrder": 1,
"estimatedMinutes": 5,
"required": True,
"enabled": True
}

procedureStepId, message = system.kanoa.cmms.addProcedureStep(procedureStepInfo, userId)
print procedureStepId, message