1. Home
  2. 5. Workflows & Automation
  3. 5.2 Building Logic in Workflows

Node-Based Logic vs JavaScript Logic

Understand the difference between building workflows using Rayven's visual node-based tools versus custom JavaScript logic.

Overview

Rayven workflows allow application builders to define automation, data processing, and interface logic using two primary approaches: node-based logic and JavaScript-based logic. Both methods are supported natively within the Workflow Builder and can even be used in combination. Understanding the differences—and when to use each—will help you design efficient, maintainable, and scalable workflows.


Node-Based Logic

Node-based logic is Rayven’s visual, drag-and-drop approach to building workflow functionality. Each node represents a discrete function such as data transformation, filtering, aggregation, or integration with external systems. Nodes are connected in sequence to define the logic flow.

Characteristics

  • Low-code, visual development: Logic is constructed by chaining together nodes.

  • Modular and inspectable: Each node encapsulates a function, and you can view the inputs and outputs using the Inspect Data tab.

  • Wide variety of functions: Includes connectors, logic rules, filters, aggregators, and frontend widgets.

When to use it

  • For most standard data flows, logic rules, calculations, and system integrations.

  • When clarity, reusability, and debugging visibility are important.

  • When working with platform-native features such as table updates, API connections, or UI widgets.

Example Use Cases

  • Creating conditional workflows using Rule Builder, Case, or Conditional Filter nodes.

  • Performing time-based calculations using Count Value by Time, Calculate Value Over Time Span, etc.

  • Reading and writing to Primary or Secondary Tables using Query Table and Update Table nodes.

JavaScript Logic

JavaScript logic is implemented using the JavaScript or UI Code nodes. These nodes allow custom scripting to handle complex or specialised tasks that aren't easily achieved through standard nodes.

Characteristics

  • Code-first flexibility: Developers write JavaScript to manipulate the incoming JSON payload directly.

  • Supports custom interfaces: UI Code nodes allow custom HTML, CSS, and JS for building interactive frontend widgets.

  • Can read/write to tables: The UI Code node supports functions like getDataFromTable() for direct table access.

When to use it

  • When complex business logic or transformations are difficult to express with existing nodes.

  • When you need fine-grained control over data structures or presentation.

  • When creating fully custom widgets or frontend interfaces.

Example Use Cases

  • Parsing and transforming nested JSON that standard nodes can't easily handle.

  • Creating dynamic UI components that interact with data tables.

  • Triggering multi-step logic from a button or form submission using sendData().


Using Both Together

Rayven workflows are designed to support a hybrid approach. It's common to start with node-based logic and selectively introduce JavaScript only where it adds real value.

Example Hybrid Scenario

  1. Use Query Table to fetch relevant records.

  2. Pass them to a JavaScript node for filtering or transformation.

  3. Push the output to an Update Table node or UI Code widget.


Summary

Rayven supports both visual and code-based logic to give you the flexibility needed to build powerful, custom applications. Node-based logic is fast and easy to maintain, while JavaScript unlocks deep customisation. Use each where it fits best—and combine them when needed—to create workflows that are both robust and adaptable.


FAQs

Can I use both node-based logic and JavaScript in a single workflow?
Yes. You can chain node-based and coded logic together freely. For example, use a Query Table node to fetch data and then process it further using a JavaScript node.

What’s the difference between the JavaScript node and the UI Code node?
The JavaScript node is for backend processing logic, while the UI Code node is used for frontend widgets and interface logic. Both support JavaScript, but only UI Code supports HTML/CSS and interaction with users.

Is the JavaScript I write stored or versioned?
JavaScript written in nodes is stored with the workflow. However, versioning or code history is not provided by default—manage this externally if needed.

Can I use table functions inside JavaScript nodes?
Only the UI Code node supports special functions like getDataFromTable(). The JavaScript node only processes the current JSON payload.

When should I avoid using JavaScript?
If your logic can be achieved using standard nodes, prefer them. Node-based logic is easier to debug, document, and maintain—especially for collaborative projects or less technical users.