Skip to main content

system.mes.material.validateMaterialReasonCode

Description

Validates the specified parameters for a Material Reason Codes record and returns any validation errors. This only checks if the material reason code object can be saved based on the attributes given.

Syntax

system.mes.material.validateMaterialReasonCode(**material_reason_code_data)

Parameters

ParameterTypeDescription
lotRecordTypeStringThe action that was taken on a lot.
reasonCodeStringThe unique code identifying the reason for material handling.
descriptionStringThe detailed description of the reason for the material activity.
requireCommentsBooleanIndicates whether additional comments are required when using this reason code.
idString (ULID)The ULID of the material reason code (optional, used for updating an existing material reason code).
notesStringNotes related to the material reason code.
enabledBooleanIndicates if the material reason code is active and enabled.
spare1StringAdditional field for user-defined context.
spare2StringAdditional field for user-defined context.
spare3StringAdditional 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

# Generate the object structure for a new material reason code object
material_reason_code_data = system.mes.material.newMaterialReasonCode()

# Set basic attributes for the new material reason code
material_reason_code_data['lotRecordType'] = 'CONSUME'
material_reason_code_data['reasonCode'] = 'SCRP001'
# (You can continue setting other properties as needed here)

# Validate material reason code parameters
validation_errors = system.mes.material.validateMaterialReasonCode(**material_reason_code_data)

if len(validation_errors) > 0:
print('Validation errors found:', validation_errors)
else:
print('Material reason code parameters are valid.')