Skip to main content
Version: V2 (Ignition 8.1)

system.mes.meter.validateMeterType

Description

Validates the specified parameters for a Meter Type record and returns any validation errors. This only checks if the Meter Type object can be saved based on the attributes given. It does not persist the record.

Permissions

This method requires the METERING.READ.VALIDATE permission.

Syntax

system.mes.meter.validateMeterType(**meterTypeData)

Parameters

ParameterTypeNullableDescription
idString (ULID)TrueThe ULID of the Meter Type (optional, for validating an update).
nameStringFalseDisplay name for this meter type.
usageUnitOfMeasureIdString (ULID)FalseThe ULID of the unit of measure for usage values.
costDoubleFalseDefault cost per unit of measure.
costUnitOfMeasureIdString (ULID)FalseThe ULID of the unit of measure for cost values.
notesStringTrueNotes related to the meter type.
enabledBooleanTrueIndicates if the meter type is active and enabled.
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. An empty object indicates no violations.

Code Examples

# Validate a Meter Type before saving
meterTypeData = system.mes.meter.newMeterType()
meterTypeData['name'] = 'Electricity'
meterTypeData['usageUnitOfMeasureId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2D'
meterTypeData['cost'] = 0.12
meterTypeData['costUnitOfMeasureId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2E'

violations = system.mes.meter.validateMeterType(**meterTypeData)

# Output any validation violations
print(violations)