Description
The SetFlavor function is used to programmatically set the value of a custom field (Flavor) within a project or a task. It is often used in workflows to dynamically update custom data fields.
SetFlavor is particularly helpful when values generated or calculated in a workflow should be written automatically into a flavor.
Syntax
SetFlavor(flavorName: string, value: string, id: guid)
Arguments
| Argument | Description |
|---|---|
flavorName |
Exact display name of the custom field (flavor) to be written. |
value |
Value to be written into the field. Always pass as a string, even if the field is internally e.g. a number or a date. If needed, use the asType function to convert the value. |
id (optional) |
GUID of the target object (project/task). If omitted, the current object is used. |
Return types
No return value. SetFlavor writes the specified value into the target field.
Examples
| Description | Formula |
|---|---|
| Simple write to the current object |
Process(
SetFlavor("Project status", "In progress")
)
Sets |
| Dynamic value (calculation as string) |
Process(
SetFlavor("Cost overview", asType("string", sumAll("Costs", true)))
)
The sum of all costs is written to the |
Write to another object via id |
Process(
SetFlavor("Priority", "High", "01234567-89ab-cdef-0123-456789abcdef")
)
Updates |
| Usage in a button |
createButton(
1,
"Project status to 'Completed'",
"Sets the project status",
"Process(
SetFlavor('Project status', 'Completed')
)",
"",
"",
"",
"The project status has been updated.",
"",
"check-circle"
)
On click, the button writes “Completed” to |
Notes
- Exact name:
flavorNamemust exactly match the field name defined in Smenso. - Context: Without an
id, the function acts on the current object (e.g., project or task). - Combination with other functions:
SetFlavorcan be combined with other functions such asif,sumAll, orformatto create dynamic values. - Using the
Process()function: To avoid errors like"Can not execute async functions outside async context",SetFlavormust be used insideProcess().
Comments
0 comments
Please sign in to leave a comment.