Learn how to write reusable logic that you can use across apps in a workspace.
As of r338, Functions is in Production Early Access. To request access, contact your Customer Success manager.
Read more in the Community thread here.
Overview
Functions is a Tulip feature that allows you to standardize logic, reuse integrations, and accelerate app development. With functions, you can:
- Create reusable logic with a visual UI
- Avoid duplicating dozens of triggers across hundreds of steps
- Make key business logic easier to manage in a central location
- Use native looping logic and complex conditional statements
In the current release, Functions v1 run locally in the Player and are invoked only from Apps. In the future, Functions will be able to run server-side and be invoked from other Functions or Automations.
Common use cases include:
- Consolidate core Work Order processing logic across hundreds of apps
- Bundle multiple connector calls for easy ERP data integrations
- Reuse logic for barcode scans and manual barcode entry, including consistent navigation
- Standardize data processing (ex: pass data to a Function to standardize how it is written to a table)
- Looping logic that occurs through storing an array of data to Table rows
Why use functions?
Reusability is the core purpose of functions, in which you manage logic in one place and then apply it across multiple apps.
Functions enable centralized logic: a system that manages decisions and controls with a single component.
Centralized logic allows you to break down problems into small, logical pieces. These pieces are foundational blocks you can iterate on to deploy changes across a workspace.
When you use a function across multiple apps, you only need to update the logic of that function to update the apps.
Functions streamline change management by eliminating redundant logic, and improve governance by guaranteeing adherence to validated, centralized components.
How do functions work?
Logic
Functions logic structure is comprised of actions and decisions. Each function begins with a function call event and then uses action and decision blocks to build complex logic.
Inputs and outputs
Inputs and outputs pass data in a function.
Any changes to inputs or outputs will immediately push to the Development versions of apps that use the function. This means that Development versions will not run correctly if you change an input or output that conflicts with logic relying on those data points.
As a best practice, you should only change a function’s logic and avoid changing inputs and outputs, unless it’s critical to your operation. If you need to change inputs or outputs, plan extra time for detecting, updating, and validating downstream logic.
Call functions from apps
In the trigger editor, use the action Run Function to call a function from an app.
The function will run in the trigger queue.
Publish an app with a function
When you update or save a function, the Development Version of an app is also updated. Previously published app versions do not change, as they use the previous function snapshot.
Learn more about function versions here.
Upon publication, Tulip checks for any changed function inputs or outputs (see Inputs and Outputs). Address these warnings before publishing to avoid your function erroring in production.
Versions
Functions are versioned in snapshots, just like Connectors. When you publish an app, it also publishes a snapshot of the function in use. Snapshots will never change once published.
The following data is snapshotted on app publish:
- Logic Blocks
- Variables
- Signature (Inputs & Outputs)
Functions currently do not have import/export capability - this is coming soon.
Technical behavior
Execution
-
Functions execute locally to the client that calls them. For example, if a function is called from an app, it will be executed locally on the Tulip Player.
-
Functions execute serially in the trigger queue. This means the order of execution for Functions and Triggers works the same.
Limits
- Functions can hold up to 1000 task executions per function run.
- Functions can have up to 100 logic blocks in the editor.
Because Functions run serially in the Trigger Queue, they also follow trigger limits.
Create a function
To create a function, navigate to the Functions page from the Apps tab.
- Click + Create Function
- Name the function and add an optional description.
- Click Create.
Did you find what you were looking for?
You can also head to community.tulip.co to post your question or see if others have solved a similar topic!