Set attribute value
Syntax
$object.set(`$attribute`, value)
Description
Updates the value of the attribute of the object to value.
The value is replaced as a whole, including elements the user may not discover; these are removed as well. To change single elements, use add and remove, which keep all other elements. For example, $o.set(`$attr`, $o.get(`$attr`).concat($x)) removes all elements the user cannot discover, since they are not part of the value the script sees. A reference can only be set to objects the user may discover (or that are already referenced).
Parameters
| Name | Type | Description | Mandatory | Default |
|---|---|---|---|---|
| object | Business object | An object whose attribute value is to be set. | yes | |
| attribute | String | An attribute literal defining the attribute to be set. | yes | |
| value | Number/string/boolean/business object/set | The new value of the attribute. | yes |
Examples
{
a = new(`my.module:MyClass`);
$a.set(`my.module:MyClass#name`, "newName");
}
Output: Creates a new object and changes the value of the attribute name to "newName".