Script Types

Tabidoo supports several types of scripts that can be applied in different contexts of your application. Understanding the purpose and scope of each script type helps you decide the best place to implement your custom logic.

1. Form/Record Event Scripts

Form/Record event scripts are triggered during specific moments in the record editing lifecycle.

  • On Model Load
    • Triggered when a form/record is opened.
    • Use to initialize values, hide fields, or make async calls.
  • On Model Change
    • Triggered when a specific field value is changed.
    • Ideal for reactive behaviors based on user input.
  • Before Model Save
    • Executes just before saving the form/record.
    • Useful for validations, calculated fields, or creating related records.

These scripts have access to the doo.model and other doo system objects and functions.

2. Form Button Scripts

You can add custom buttons directly to a form. When clicked, these buttons execute scripts tied to the current record.

  • Trigger logic in response to user actions within the form.
  • Modify field values or call APIs.
  • Show confirmation dialogs or custom messages.

These scripts run in the browser and can interact directly with the form UI.

3. Table Button Scripts

These buttons are placed above the table view and are part of Workflow Automation triggers. When clicked, they can process one or multiple selected records.

  • Can be used to start a Workflow with selected records.
  • Scripts run as part of a Run Script action in the Workflow.
  • Useful for bulk operations or approvals initiated by the user.

4. Workflow Scripts

Scripts can be used in automation workflows via the Run Script action.

  • Run when a record is created, updated, or when triggered manually (e.g., via Table Button).
  • Perform conditional logic and interact with data.
  • Combine with other automation actions like sending emails, updating records, etc.

Workflow scripts are written in JavaScript/Typescript and typically executed server-side.

5. Scripting Extensions (Shared Scripts)

Reusable logic can be defined in Scripting Extensions, which are shared across multiple script contexts.

  • Define helper functions.
  • Centralize commonly used operations (e.g., calculations, business logic).
  • Reduce repetition in your scripts.

Scripting Extensions promote modular and maintainable code.

Summary Table

Script TypeTrigger ContextVisibilityTypical Use Cases
Form EventOn Load / Change / SaveClient-sideForm logic, validation, dynamic UI
Form ButtonButton in formClient-sideRecord-specific actions, API calls
Table ButtonButton above table (workflow)Client-side / Server-sideBulk operations, manual workflows
Workflow AutomationWorkflow "Run Script" actionClient-side / Server-sideBusiness processes, notifications
Scripting ExtensionsReferenced by other scriptsInternal useShared functions, utilities

 

Use the right script type for your scenario to maintain performance, readability, and security across your Tabidoo applications.