In this example, we will take a look at configuration of an automation rule that sets specific attributes for a newly created object. The rule will apply to objects in the Operational Metrics space and update both the description and workflow state.
We will configure the following properties:
| Trigger | Stream | Action |
|---|---|---|
| A new Document object is created | Objects in the Operational Metrics space | The new object’s description is automatically set to a variation of: “AVERAGE DAILY TRANSACTION VOLUME IN Q1: Document number #001. Awaiting documentation.” |
Download the example automation rule here: Example - Setting Attribute.json
Trigger
Let’s begin by defining the trigger. In our example, the rule activates when a new object (objectAdded trigger type) of type Document (core_documentation_document) is created. While this example includes a single trigger, you can define multiple triggers as needed.
{
"$schema": "https://schema.dawiso.com/automation-schema.json",
"automations": [
{
"key": "cust_setAttribute",
"name": "Set Documentation Set Attribute",
"triggers": [
{
"key": "objectAdded",
"type": "objectAdded",
"objectTypeKeys": [ "core_documentation_document" ]
}
]
}
]
}
Stream
Next, we define the stream to determine which objects the rule applies to. In this example, we use a logical formula to filter for objects located in the Operational Metrics space and within the Documentation (core_documentation_app) application.
Even though Document cannot be created in other applications, it’s still a good practice to include this filter for clarity and maintainability.
{
"$schema": "https://schema.dawiso.com/automation-schema.json",
"automations": [
{
"key": "cust_setAttribute",
"name": "Set Documentation Set Attribute",
"triggers": [...],
"stream": [
{
"key": "logicalFormula",
"type": "logicalFormula",
"operator": "and",
"clauses": [
{
"type": "spaceFilter",
"operand": "in",
"values": [ "Operational Metrics" ]
},
{
"type": "applicationFilter",
"operand": "in",
"applicationKeys": [ "core_documentation_app" ]
}
]
}
]
}
]
}
This example uses custom space, so make sure to replace the space name (Operational Metrics) with a space available in your environment.
Actions
Finally, we need to define the actions that will be applied to the filtered objects. In this example, the automation sets the object’s description attribute (expression).
The new object’s description is automatically generated based on the parent object’s title, a sequential document number, and a placeholder status, for example:
Click here to show the example object description.
AVERAGE DAILY TRANSACTION VOLUME IN Q1: Document number #001.
Awaiting documentation.
{
"$schema": "https://schema.dawiso.com/automation-schema.json",
"automations": [
{
"key": "cust_setAttribute",
"name": "Set Documentation Set Attribute",
"triggers": [...],
"stream": [...],
"actions": [
{
"key": "setAttribute",
"type": "setAttribute",
"attributeTypeKey": "core_description",
"expression": "<b>{{currentObject}.parent().attribute('core_description').toUpper()}: Document number #{{constantIdPool.example_pool}.leading(3,'0')}<b>.
Awaiting documentation."
}
]
}
]
}
This action dynamically constructs a description using:
- The parent object’s description, converted to uppercase
- A sequential number from the
example_poolID pool - A static status message indicating the object still requires documentation
You can customize the expression to suit your use case. Dawiso’s expression language supports a wide range of transformations, lookups, and formatting options.
You can use HTML in your expressions to style the text.