Introduction to Scripting
Tabidoo uses JavaScript/Typescript as its scripting language, enabling customization of forms, automation of workflows, and data operations that go beyond built-in features.
Why Use Scripting?
Use scripting when:
- You need to pre-fill or compute values dynamically.
- Fields must be shown or hidden based on user inputs.
- Advanced validations are required.
- Data must be synchronized across related tables.
- Records need to be created or updated programmatically.
- You want to send data to external APIs.
Where You Can Use Scripts in Tabidoo
Tabidoo supports scripting in various contexts:
- Form/Record Events: Attach scripts to the lifecycle of a form/record:
- On Model Load – Triggered when the form is opened.
- On Model Change – Runs when a field's value changes.
- Before Model Save – Executes before saving the form.
- Form Button: Add buttons to form that execute custom logic.
- Table Button: Add buttons above the table that execute custom logic (part of Workflow Automation triggers).
- Workflow Automation: Use scripting in automation actions.
- Scripting Extensions (Shared Scripts): Define reusable functions and logic shared across scripts.
Key Features
- JavaScript-based: Familiar to web developers, powerful for dynamic behavior.
- IntelliSense support: Code suggestions via
Ctrl + Space. - Browser-compatible: Runs in the user’s browser (or on the server for encrypted scripts).
- Flexible integration: Access other tables, call APIs, or use shared functions.
Getting Started
To begin using scripting (Form/Record Events) in Tabidoo:
- Open the table context menu where you want to add custom behavior.
- Select Scripting.
- Choose the appropriate event (e.g., On Model Load).
- Start writing your JavaScript/Typescript code:
doo.model.yourFieldName.isVisible = doo.model.status.value === 'Closed';Example: Hide a field "yourFieldName" based on another field's value (status)
To begin using scripting
Debugging Tips
When working with scripts, it is often useful to inspect values or check how the doo.model object looks at runtime.
You can use the browser developer console to debug your code.
Inspect the model object
To see all available fields and their current values, use:
console.log(doo.model);
This prints the entire model object into the browser console so you can explore its structure.
Debug step by step
You can pause script execution and inspect variables using the debugger command:
debugger;
When the browser encounters this line, execution stops and the developer tools allow you to inspect variables, step through the code, and evaluate expressions.
⚠️ Remember to remove
debugger;from your script once debugging is finished.
Opening the developer console
You can open the browser developer console using:
| Browser | Shortcut |
|---|---|
| Chrome / Edge | F12 |
| Chrome / Edge | CTRL + SHIFT + I |
| Opera | CTRL + SHIFT + I |
Other browsers provide similar shortcuts.
Tip
If you're unsure what values are available in your script, logging the model is often the fastest way to understand the data structure.
console.log(doo.model);Next Steps
Explore related articles for deeper knowledge:
Scripting unlocks the full potential of Tabidoo. Whether you're customizing forms or integrating with third-party systems, it offers the flexibility needed to meet complex requirements.