Update a field value (Field.update)
You can use Field.update to alter a specific field value from a given dataset using its unique identifier.
Syntax
Field.update(dsIdOrName, value, valuePath, indexOrId);
Parameters
The update function takes the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| dsIdOrName | String | Yes | BizzStream will use the name or the id of the dataset to retrieve the data from it. |
| value | any | Yes | The new value. |
| valuePath | String | Yes | Path to the value inside the document. |
| indexOrId | String | No | Index or ID - Document on which the action is being executed. (If not specified will be defaulted to 0). |
Side effects
When updating a field keep in mind that all the relations that are based on the field value are going to be re-evaluated:
- dynamic values
- display conditions
- coloring conditions
- dynamic validation conditions
- etc.
Return value
No return value.
Example
Field.update('vendorsDataset', 'Van Meijel', 'name', '1');
const newName = Field.get('vendorsDataset', 'name', '1');
if (newName === 'Van Meijel') {
notification.success('Vendor updated!',`Current vendor name is: ${newName}`);
}