The Set Variables node is useful for temporary fields within a workflow. These fields do not need to be stored permanently against a record so can help keep apps cleaner without the need for unnecessary hidden fields. It also allows for quick and easy changes within the workflow without having to leave.
Set Variables Node
In the example above, the variables are represented with the Var.Name
format.
- Variable Name: This field is where you specify the name of your variable. It works similarly to a field ID but does not require a label since it's not a visible option in the workspace.
- Expression: Enter the expression for the variable you wish to create here.
- Add Another Variable: This option allows you to add more variables within the same node.
Note: When using the set variable node it will figure out the field type by itself, i.e. If you are adding two number fields together it will make it a number field type and should be referenced as such later on.
Note: These work very similar to normal fields so when in doubt write it like you would for a normal field expression but a Var. before the field name. [FieldID] = [Var.FieldID]
When using your variable in a node that makes an external update to another app, i.e. "update app field value" or "update child field value", or a "create record" node, you will need to use a sourcevar('','') function, this also works similar to the Source. function seen elsewhere. There is an example of it being used further down.
Variable = Var.OpenActions
Source Variable = sourcevar('OpenActions','No Actions')
Note: This would be similar to insull('','') where if it can't find a value for the source variable the second set of quotes is what should be entered instead.
Example
Consider a scenario where a Set Variables node is used in sending a project update. The sequence works as follows:
- Button Clicked: Initiates the workflow.
- Set Variables: Determines the number of open actions using an expression. Using the example from earlier,
[Var.OpenActions] = [ToDo] + [InProgress]
. - Filter:
- If
[Var.OpenActions] > 30
, the workflow proceeds to send an email notifying managers that actions are backed up and also sends a Teams message. - If
[Var.OpenActions] < 30
, an email is sent indicating that the project is healthy.
- If
The total number of actions is dynamically included in the communications using expressions like @Softools.FieldValue("Var.OpenActions")
for emails and [Var.OpenActions]
for Teams messages thanks to the variable set earlier on.
For more on how to send teams messages please click here
You could also add a create record node that creates an action linked to the project to reduce the number of actions by a certain date. This would need to use the sourcevar('','') function like below.
Comments
0 comments
Please sign in to leave a comment.