TxScript Overview

Introduction to TxScript, the JavaScript library powering AI Builder

What is TxScript?

TxScript is a JavaScript-based scripting library that powers AI Builder features in 1Flow. It provides a safe, controlled way to write scripts that interact with your financial data through a capability-based API.

The key principle of TxScript is that all interactions go through a capability object (tx or uiTx) - scripts never access platform internals directly. This ensures security, validation, and proper resource management.

Two Variants

TxScript comes in two variants, each optimized for different use cases:

1. Formula Fields (tx)

  • Runtime: Server-side during document extraction
  • Scope: Single document context
  • Use Case: Field validation, transformation, and enrichment during document processing
  • Learn more: Formula Fields documentation

2. AI Builder & Tasks (uiTx / tx)

  • Runtime: Client-side (mini-apps) or server-side (tasks)
  • Scope: Organization-wide data access
  • Use Case: Building interactive mini-apps and scheduled automation tasks
  • Learn more:

Core Concepts

Capability-Based API

All TxScript variants use a capability-based architecture:

  • Read operations: Access data through controlled methods
  • Write operations: Mutate data through validated methods
  • Side effects: Make HTTP requests, send notifications, log messages

Execution Model

TxScript supports async/await, allowing you to make HTTP requests and perform asynchronous operations. All async operations must go through capability methods, which enforce limits and security controls.

Security & Limits

All variants enforce:

  • Rate limits: Maximum calls per execution
  • Timeouts: Maximum execution time
  • Validation: All inputs validated and sanitized
  • Isolation: No direct access to platform internals

Choosing the Right Variant

Use CaseVariantDocumentation
Validate or transform a field during document extractionFormula Fields (tx)Formula Fields
Build an interactive dashboard or reportMini Apps (uiTx)Mini Apps
Schedule automated reports or workflowsTasks (tx)Tasks

Getting Started

  1. For Formula Fields: See Formula Fields documentation
  2. For Mini Apps: See Mini Apps documentation
  3. For Tasks: See Tasks documentation

Editing TxScript Code

You have three options for working with TxScript:

  1. Use AI Builder: Let AI generate the code from natural language descriptions
  2. Edit manually: If you're comfortable with JavaScript, edit the code directly
  3. Hire a professional: Have a developer customize the code - there are no runtime costs