Introduction
Activity blocks in Studio Pro require you to specify certain parameters in order to perform the action correctly. These can be input boxes, buttons, radio buttons, checkboxes or drop-down lists.
Parameters that are mandatory for an activity are indicated by a red asterisk (*). If the mandatory parameter is not pecified, then:
- When you deselect the activity block, an unfilled parameter will get highlighted in the parameter section, and the "!" symbol will appears in the activity block.
- The workflow will not be executed.
Depending on the function to be performed, the activity parameters may differ.
In this article we will review the principles of the basic parameters and examples of their use.
Assigning a certain value
Many activities involve assigning a value to a parameter. For example, in the Input to desktop app activity, you must specify the text you want to enter.
Most frequently, when setting a value, you must select one of three options:
- Set a value
- Calculate a value
- Save the previous step result
Let's take a closer look at these options.
Set a value
This option means that anything entered in the "Value" field will be interpreted as a string or number. For example, if you type The city of New York
, the value will automatically be interpreted as a string (text). If you write a number, such as 123
, the value will be interpreted as a number.
The table below shows some examples of interpretations.
Input value | Type | Output value |
831 |
Number | 831 |
Contragent name |
String | "Contragent name" |
213+932 |
String | "213 + 932" |
true |
String | "true" |
“Today ” + new Date() |
String | "\"Today\" + new Date ()" |
[1,2,3,4].filter(x => x >2) |
String | "[1,2,3,4].filter(x => x >2)" |
Calculate a value
This option allows you to calculate a value using JavaScript syntax.
For example, if you set the contragent_exists
variable to true
, then the variable will take the boolean type and value true. If you write "The city of New York"
in the city
variable, it will become a string.
The table below shows the results for the same examples as in the previous table.
Input value | Type | Output value |
831 |
Number | 831 |
Contragent name | Undefined | Error "Unexpected identifier" |
213+932 |
Number | 1145 |
true |
Boolean | true |
"Today " + new Date() |
String | "Today Thu Jul 06 2021 15:33:24 GMT+0300 (MSK)" |
[1,2,3,4].filter(x => x >2) |
Array of numbers | "[1,2,3,4].filter(x => x >2)" |
If you use the "Calculate a value" option, it is also possible to use additional libraries - lodash, moment.js and mustache:
//Examples of references to lodash, moment, mustache
_.has(); //lodash
moment().add(); //moment
mustache.render(); //mustache
Set the previous step result
If the "Save the previous step result" option is selected, the value returned by the activity from the previous step will be used as the value (if the activity does not return a result, the value will not be written).
Suppose we need to read a text from a file (without changing it in any way) and send an email containing this text. The algorithm will look like this:
This simple workflow contains two activities:
- Read text file - this activitiy reads the text from a file.
- Send email - this activity sends an email. It takes the text read from the file as the body of the email, since we select the "Save the previous step result" option in the "Mail body" parameter.