Skip to main content

system.mes.unitOfMeasure.newUnitOfMeasure

Description

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

Permissions

This method does not require any permissions.

Syntax

system.mes.unitOfMeasure.newUnitOfMeasure()

Parameters

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

Returns

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

KeyDefault Value
namenull
symbolnull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

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

# Set basic attributes for the new unit of measure
newUom['name'] = 'Pound'
newUom['symbol'] = 'lb'
# (You can continue setting other properties as needed here)

# Save the new unit of measure to the system
savedUom = system.mes.unitOfMeasure.saveUnitOfMeasure(**newUom)

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