Script Types
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 Type | Trigger Context | Visibility | Typical Use Cases |
---|---|---|---|
Form Event | On Load / Change / Save | Client-side | Form logic, validation, dynamic UI |
Form Button | Button in form | Client-side | Record-specific actions, API calls |
Table Button | Button above table (workflow) | Client-side / Server-side | Bulk operations, manual workflows |
Workflow Automation | Workflow "Run Script" action | Client-side / Server-side | Business processes, notifications |
Scripting Extensions | Referenced by other scripts | Internal use | Shared functions, utilities |
Use the right script type for your scenario to maintain performance, readability, and security across your Tabidoo applications.