Operation
Create and delete operations
Operations for objects and links can be created in the Operations section. You can also edit, delete and execute an existing operations.
You can also set default operations for object classes in system configuration window.
All new objects will have operations defined in their classes.
You can also create operations for classes and entities in the REST API.
Executing operations
You can execute operations one of the following ways:
Execution event and the result of the operation are recorded in the Operations history log with the execution timestamp and the user who executed the operation. |
Using variables in operations
You can use provided variables to pass some system information to operations. You can use variables in the topic and message of operations of type MQTT message, and in the body of the script of the operation of type Program/script execution – Script with text.
The following variables can be used in operations:
-
{{id}}
– ID of the object, in which the operation is executed; -
{{properties.property_name}}
– property value of the object, in which the operation is executed (the name of the property is specified in the variable); -
{{jobId}}
– ID of the executed operation;The identifier is unique for each execution, details are in the REST-API documentation. -
{{user.id}}
– ID of the user, who has executed the operation; -
{{user.login}}
– login of the user, who has executed the operation.
Ask users to set operation arguments
Before executing an operation, you can ask users to input an argument that will be passed to the operation’s script. To do this, add the {{ask.argument_name}}
to the script.
For the operation of "Program/script in file system" and "Script from repository" subtypes, you can only add this macro in the "Arguments" list. For the "Script with text" subtypes, you can add {{ask.argument_name}}
macro either to the script’s source text or to the list of arguments.
This functionality works only for "Program / script execution" operations. If you try to use this feature in operations of "MQTT Message" type, the {{ask.argument_name}} macro will be replace by an empty string.
|
For example, the following operation will ask a user that manually executes it for the values of packets_count
and ip_address
variables:
#!/bin/bash
ping -c {{ask.packets_count}} {{ask.ip_address}}
When a user executes this operation, the system will prompt them to enter values of the packets_count
and ip_address
arguments:


You can use this macro in the "Arguments" list as well:


The example above has to be modified to handle arguments from "Arguments" list:
#!/bin/bash
ping -c "$1" "$2"