system.mes.material.newProperty
Description
Generates an empty non-persisted Material Properties object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveProperty method in order to persist the record.
Permissions
This method does not require any permissions.
Syntax
system.mes.material.newProperty()
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
| None | - | - | This method does not take any parameters. |
Returns
Returns a JSON representation of the newly created material property object. The following is a list of keys and default values:
| Key | Default Value |
|---|---|
materialClassId | null |
name | null |
description | null |
dataType | String |
lowLimit | null |
highLimit | null |
format | null |
unitOfMeasureId | null |
unitOfMeasureName | null |
unitOfMeasureSymbol | null |
options | null |
nullable | false |
defaultValue | null |
id | null |
notes | null |
enabled | true |
spare1 | null |
spare2 | null |
spare3 | null |
Code Examples
# Generate the object structure for a new property object with no initial arguments
newProperty = system.mes.material.newProperty()
# Define property details
newProperty['materialClassId'] = '01JCH3ENEB-SV2X8B3W-NFY8WZNK'
newProperty['name'] = 'Density'
# (You can continue setting other properties as needed here)
# Save the property
savedProperty = system.mes.material.saveProperty(**newProperty)
# Output the JSON representation of the saved property
print(savedProperty)