Skip to main content

Flow Editor

The editor is a built in tool for editing code related to methods, flows and custom views, that can be found in the menu by clicking “Configuration” and then “Methods”. This will bring you to the overview of the Method editor (detailed in Methods overview section) where you can start building your own personalized functionality or browse some of the customizable files of the system.

Important disclaimer: Any changes made to existing files or creation of new files can negatively affect the system as a whole if you don't know what you are doing. Always ask an administrator or Flow support if you are unsure.

The files created within the editor can be written in either JavaScript(/HTML) or Python. Commonly views are written in JS and methods are written in Python. You can also create a Flow from here, that graphically allows you to piece together different methods into a bigger unit , more on that in the What is a flow and Creating a flow sections.

To create a new file, click on the plus sign of the folder you wish to add a file.

Add a file

This will cause a modal to appear as shown in the image below. Give your new file a name , Namespace and Type. The different types are explained in the next section. The namespace given to the flow will dictate where in the system it will be used.

Modal

Type (Flow Editor)

When creating a new method you are prompted to select a type. The type is like a ruleset for the method that both describes and decides some of its functionality and parameters. The five most commonly used types are:

View

A custom view that can be added to a namespace such as address, in order to give it an extended GUI.

Method

A Python method that can either be used together with other views and methods or on it's own as a runnable method in Run.

Flow

A graphical and in some cases more user friendly way to create your own functionality. A more detailed overview of this is given in the What is a Flow and Creating a Flow sections.

Library

A collection of methods, functions and classes that can only be accessed locally within the folder that it is created.

Global

The same thing as a Library, however it can be accessed globally in the editor and is not bound to its folder. Care should be taken to make sure that two different Globals does not have the same name.

Flow Python Library Documentation

The Flow library facilitates interactions within the Flow framework, providing a comprehensive set of methods for managing state, performing operations, and interacting with the API.

Core Methods
Initialization and State Management
  • Flow.getFlow(): Retrieves the singleton instance of the Flow class, ensuring only one instance exists throughout the execution.

  • Flow.setStatusCode(code): Sets the status code for the current execution context. This code can dictate the flow of operations based on its value.

  • Flow.setSleepTimer(sleepTimer): Specifies a timer in seconds to put the process to sleep, effectively delaying its execution.

  • Flow.getReloadCode(): Returns the current reload code status, indicating whether a code reload is requested.

  • Flow.setReloadCode(value): Sets the reload code status, allowing the system to know if a reload of the codebase is necessary.

  • Flow.clean(fullCleanup): Cleans up the execution environment. If fullCleanup is true, it performs a full cleanup, including closing and resetting output streams.

Output and Logging
  • Flow.jsonOutput(): Converts the current output data to a JSON string, suitable for returning as an API response or logging.

  • Flow.error(msg): Logs an error message to the standard error stream.

  • Flow.out(msg): Outputs a message to the standard output stream.

Data Retrieval and Management
  • Flow.getObjectId(): Retrieves the unique object ID associated with the current execution context.

  • Flow.getData(): Returns the data associated with the current Flow instance in JSON format.

  • Flow.getSleepTimer(): Retrieves the currently set sleep timer value.

  • Flow.getSetting(key, defaultValue): Fetches a configuration setting by key, returning a default value if the key does not exist.

  • Flow.setSetting(key, value): Sets a configuration setting by key to a specified value.

  • Flow.getInput(key, defaultValue): Obtains an input parameter by key, providing a default value if the key is not present.

  • Flow.setOutput(value, key): Sets an output parameter by key to a specified value.

Remote Procedure Calls (RPC)
  • Flow.rpcCall(method, endpoint, namespace, objectId, data, params): Executes an RPC call with the specified method, endpoint, and optional parameters, returning the response.

  • Flow.rpcOpen(endpoint, objectId): Initiates an RPC call to open a specific resource identified by an endpoint and object ID.

  • Flow.rpcCreate(endpoint, data, objectId): Performs an RPC call to create a new resource with the given data at the specified endpoint.

  • Flow.rpcList(endpoint, objectId, searchItems, sortBy, sortOrder): Lists resources from an endpoint, optionally filtering, sorting, and ordering based on provided criteria.

  • Flow.rpcDelete(endpoint, namespace, objectId): Executes an RPC call to delete a resource identified by an endpoint, namespace, and object ID.

  • Flow.rpcUpdate(endpoint, objectId, data): Updates a resource identified by an endpoint and object ID with the provided data.

This documentation covers the core functionalities provided by the Flow class, essential for integrating with and extending the capabilities of the Flow framework.

Flows

What is a Flow

A Flow is a graphical representation of code. It's main purpose is to serve as both a learning tool for less experienced coders and as a convenient way for senior developers to quickly put together functionality for your system installation. It allows the user to create functions by dragging and dropping logic, variables, methods (etc) and puzzling them together. Flows have many uses but some of the more common ones are for simpler logic such as: Mail notifications, troubleshooting, customised import/export functions. It is however not limited to these uses in any way

A flow

Creating a Flow

Create a flow

To start the process of creating a Flow, click on the plus sign next to the folder that you wish to add the Flow to and fill in the required information in the “Create a new method” modal (the required fields are Name, Namespace, Type). Once you are done, click on “CREATE”, this will take you to the blocky editor. You will start your Flow creation as a blank slate that you can add any logic you wish to.

Demo flow

To the left of the blocky editor you have all the basic variables, logic, object references and data types found in any programming language. Below that you will also see all the namespaces of your Flow installation. Clicking on any of these will bring up all the available functionality associated with it.

Blocks

If you wish to use any of this functionality in your flow, simply click on it (1.) and drag it to where your START block is (2.).

Choose blocks

Add blocks