Skip to main content

system.mes.material.newMaterialReasonCode

Description

Generates an empty non-persisted Material Reason Codes object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveMaterialReasonCode method in order to persist the record.

Permissions

This method does not require any permissions.

Syntax

system.mes.material.newMaterialReasonCode()

Parameters

ParameterTypeNullableDescription
None--This method does not take any parameters.

Returns

Returns a JSON representation of the newly created material reason code object. The following is a list of keys and default values:

KeyDefault Value
lotRecordTypenull
reasonCodenull
descriptionnull
requireCommentsnull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new material reason code object with no initial arguments
newMaterialReasonCode = system.mes.material.newMaterialReasonCode()

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

# Save the new material reason code to the system
savedMaterialReasonCode = system.mes.material.saveMaterialReasonCode(**newMaterialReasonCode)

# Output the JSON representation of the saved material reason code
print(savedMaterialReasonCode)