system.mes.material.setPropertyValue
Description
Updates the value of a Material Property Values record given a material ID or path and a property ID or name.
Permissions
This method requires the MATERIAL.WRITE.SAVE permission.
Syntax
system.mes.material.setPropertyValue(materialIdOrPath, propertyIdOrName, value)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
materialIdOrPath | String | False | The ULID or path of the material. |
propertyIdOrName | String | False | The ULID or name of the property for which the value is retrieved. |
value | Mixed | True | The value assigned to the property. The type is mixed as it depends on the data type of the property. May be None to clear the value, but only when the property definition is nullable; passing None for a non-nullable property raises an error. |
Returns
Returns a JSON representation of the updated material property value.
Code Examples
# Update the value of a material property value
updatedPropertyValue = system.mes.material.setPropertyValue('IRB/5391537510212', 'Density', 200)
# Output the JSON representation of the updated material property value
print(updatedPropertyValue)
# Clear the value of a nullable property by passing None
system.mes.material.setPropertyValue('IRB/5391537510212', 'Density', None)