Skip to main content

system.mes.unitOfMeasure.newUnitOfMeasureConversion

Description

Generates an empty non-persisted Unit Of Measure Conversions object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveUnitOfMeasureConversion method in order to persist the record.

Syntax

system.mes.unitOfMeasure.newUnitOfMeasureConversion()

Parameters

ParameterTypeDescription
None-This method does not take any parameters.

Returns

Returns a JSON representation of the newly created unit of measure conversion object. The following is a list of keys and default values:

KeyDefault Value
fromIdnull
toIdnull
conversionFactornull
materialIdnull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

# Generate the object structure for a new unit of measure conversion object with no initial arguments
new_uomc = system.mes.unitOfMeasure.newUnitOfMeasureConversion()

# Set basic attributes for the new unit of measure
new_uomc['toId'] = '01JCH3T85P-KVCB8ZR5-0B83A3SX'
new_uomc['conversionFactor'] = 0.33
new_uomc['fromId'] = '01JCH4NB3J-BTERAZ27-QEQQN4ME'
# (You can continue setting other properties as needed here)

# Save the new unit of measure conversion to the system
saved_uomc = system.mes.unitOfMeasure.saveUnitOfMeasureConversion(**new_uomc)

# Output the JSON representation of the saved unit of measure conversion
print(saved_uomc)