Skip to main content

system.mes.equipment.validateEquipment

Description

Validates the specified parameters for an Equipment record and returns any validation errors. This only checks if the equipment object can be saved based on the attributes given, without actually creating or modifying the equipment. Use this function to verify your parameters before executing operations that create or modify equipment.

Permissions

This method requires the EQUIPMENT.READ.VALIDATE permission.

Syntax

system.mes.equipment.validateEquipment(**equipmentData)

Parameters

ParameterTypeNullableDescription
nameStringFalseThe name of the equipment.
descriptionStringTrueA description of the equipment.
equipmentClassIdString (ULID)FalseThe ULID of the equipment class this equipment belongs to.
locationIdString (ULID)TrueThe ULID of the location where this equipment is stationed.
pathStringTrueThe path of the equipment.
idString (ULID)TrueThe ULID of the equipment. Used when updating.
notesStringTrueNotes related to the equipment.
enabledBooleanTrueIndicates if the equipment is active. Default value is true.
spare1StringTrueAdditional field for user-defined context.
spare2StringTrueAdditional field for user-defined context.
spare3StringTrueAdditional field for user-defined context.

Returns

Returns a JSON object where keys are field names and values are lists of validation violation messages.

Code Examples

equipmentData = system.mes.equipment.newEquipment()
equipmentData['name'] = 'Pump-101'
equipmentData['equipmentClassId'] = 'Pumps/CentrifugalPumps'
validationErrors = system.mes.equipment.validateEquipment(**equipmentData)
if len(validationErrors) > 0:
print('Validation errors found:', validationErrors)
else:
print('Equipment parameters are valid.')