### Quickstart API Request Example Source: https://help.tabidoo.cloud/en/article/api Use this cURL command to make a GET request to retrieve records from a table. Replace YOUR_TOKEN with your actual API token. All API requests require the Authorization header. ```bash curl -X GET https://api.tabidoo.cloud/api/v2/table/data \ -H "Authorization: Bearer YOUR_TOKEN" ``` -------------------------------- ### Tabidoo API - Quickstart Example Source: https://help.tabidoo.cloud/en/article/api This example demonstrates how to retrieve records from a table using the Tabidoo API with curl. Replace YOUR_TOKEN with your actual API token. ```APIDOC ## GET /api/v2/table/data ### Description Retrieves records from a specified table. ### Method GET ### Endpoint https://api.tabidoo.cloud/api/v2/table/data ### Parameters #### Query Parameters - **Authorization** (string) - Required - The API token for authentication. Format: Bearer YOUR_TOKEN ### Request Example ```curl curl -X GET https://api.tabidoo.cloud/api/v2/table/data \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### Response #### Success Response (200) - **data** (array) - An array of records from the table. - **count** (integer) - The total number of records retrieved. #### Response Example ```json { "data": [ { "id": 1, "field1": "value1", "field2": "value2" } ], "count": 1 } ``` ``` -------------------------------- ### Data Retrieval Examples Source: https://help.tabidoo.cloud/en/article/scripting-table Examples for loading data using generics, applying filters, and selecting specific fields. ```typescript const result = await doo.table.getData('Orders'); const firstOrder = result.data[0]; console.log(firstOrder.fields.amount); ``` ```typescript const result = await doo.table.getData('Orders', { filter: 'status(eq)New', sort: 'created(desc)', limit: 10 }); ``` ```typescript const result = await doo.table.getData('Orders', { loadFields: ['status', 'amount'] }); ``` -------------------------------- ### Record Counting Examples Source: https://help.tabidoo.cloud/en/article/scripting-table Examples for counting total records or filtered records in a table. ```typescript const result = await doo.table.getCount('Orders'); console.log(result.data.count); ``` ```typescript const result = await doo.table.getCount('Orders', { filter: 'status(eq)New' }); console.log(result.data.count); ``` -------------------------------- ### Example Response for Technical Limits Source: https://help.tabidoo.cloud/en/article/dooenvironment An example of the JSON response structure for getCurrentUserTechnicalLimits, detailing consumed values, limits, types, and time units. ```json [ { "value": 61183, "limit": 1800000, "type": "workflowRunsMs", "userLimitTimeUnit": "day", "userLimitValueUnit": "milliseconds" }, { "value": 876, "limit": 10000, "type": "getDataResponseCharsMB", "userLimitTimeUnit": "day", "userLimitValueUnit": "count" }, { "value": 122077, "limit": 0, "type": "getDataResponseElapsedMs", "userLimitTimeUnit": "day", "userLimitValueUnit": "milliseconds" }, { "value": 27, "limit": 10000, "type": "workflowRunsCount", "userLimitTimeUnit": "day", "userLimitValueUnit": "count" } ] ``` -------------------------------- ### HTTP Request Basic Authorization Example Source: https://help.tabidoo.cloud/en/article/scripting-http-request Illustrates how to configure basic authentication for an HTTP request using a username and password. ```javascript { username: 'abc', password: '***' } ``` -------------------------------- ### HTTP Request Headers Example Source: https://help.tabidoo.cloud/en/article/scripting-http-request Demonstrates how to set custom headers for an HTTP request. Headers are provided as a key-value dictionary. ```javascript { 'my-header': 'abc', 'my-header2': '123', } ``` -------------------------------- ### Identify DEV Application URL Source: https://help.tabidoo.cloud/en/article/dev-test-prod-recommended-deployment-workflow Example of a standard URL for a master development application. ```text https://app.tabidoo.cloud/mycompany ``` -------------------------------- ### HTTP Request Query Parameters Example Source: https://help.tabidoo.cloud/en/article/scripting-http-request Shows how to define query parameters for a URL. These are appended to the URL as a query string. ```javascript { name: 'John', surname: 'Smith', } ``` -------------------------------- ### Check Lookup Value Example Source: https://help.tabidoo.cloud/en/article/doofunctionsscripts This example demonstrates how to check the value of a lookup field within a Tabidoo script. ```javascript doo.functions.scripts.checkLookupValue = function(field, value) { var lookup = doo.table.getLookup(field); if (lookup == null) { return false; } for (var i = 0; i < lookup.length; i++) { if (lookup[i].id == value) { return true; } } return false; } ``` -------------------------------- ### Perform Custom HTTP Request Source: https://help.tabidoo.cloud/en/article/scripting-http-request Use this function to perform any type of HTTP request (GET, POST, PUT, PATCH, DELETE, etc.) by specifying the method in the options. This example shows a POST request with a JSON body. ```javascript await doo.functions.request.custom('https://myserver.com/api/employee', { body: { surname: 'New Name' }, ``` -------------------------------- ### Free HTML Widget Example Source: https://help.tabidoo.cloud/en/article/widget-free-html Use this widget to create custom elements on the screen using HTML and JavaScript. It is similar to an HTML input and is currently in Beta. ```html

This is a paragraph inside the Free HTML widget.

``` -------------------------------- ### Identify TEST or PROD Application URL Source: https://help.tabidoo.cloud/en/article/dev-test-prod-recommended-deployment-workflow Example of a URL for an application derived from a template, featuring a four-character suffix. ```text https://app.tabidoo.cloud/mycompany-abcd ``` -------------------------------- ### Apply Starting Number Offset Source: https://help.tabidoo.cloud/en/article/advanced-number-series Increments the base sequence number by a fixed value to begin numbering from a specific starting point. ```javascript Number + 900000 ``` -------------------------------- ### Combine Prefix and Starting Number Source: https://help.tabidoo.cloud/en/article/advanced-number-series Combines a custom string prefix with an offset numeric sequence. ```javascript 'prefix' + (Number + 90000).toString(); ``` -------------------------------- ### Avoid Hardcoded URLs Source: https://help.tabidoo.cloud/en/article/dev-test-prod-recommended-deployment-workflow Example of a static URL that will break when moving between environments or using custom domains. ```text https://app.tabidoo.cloud/app/myapplication/schema/asset?recordId=${doo.model.id} ``` -------------------------------- ### Call custom formatting function Source: https://help.tabidoo.cloud/en/article/scripting-extensions Example of invoking a custom formatting function defined under the myFormatting namespace. ```typescript doo.myFormatting.getTitle2Days(dateFrom, dateTo, 'en') ``` -------------------------------- ### Bulk Record Creation Example Source: https://help.tabidoo.cloud/en/article/scripting-table Create multiple records in a single API call using the `createRecordsBulk` function. Each object in the array represents a new record with its fields. ```json [ { "firstname": "Jack", "surname": "Newman" }, { "firstname": "Peter", "surname": "Novak" } ] ``` -------------------------------- ### Get Table Structure Source: https://help.tabidoo.cloud/en/article/scripting-table Loads the full structure of a table, including field definitions, settings, and attached scripts. ```APIDOC ## GET /api/table/getTableStructure ### Description Loads the full structure of a table including field definitions, settings, and attached scripts. Useful for introspection, debugging, or dynamic UI generation. ### Method GET ### Endpoint `/api/table/getTableStructure` ### Parameters #### Query Parameters - **tableNameOrId** (string) - Required - The name or ID of the table. - **applicationId** (string) - Optional - Use to specify the application context. ### Response #### Success Response (200) - **IDooGetTableStructureResponse** - An object containing structure, settings, and script definitions. - **data.id** (string) - Table ID - **data.header** (string) - Table name - **data.items** (array) - List of fields (with `name`, `header`, `type`) - **data.settings** (object) - Other table settings - **data.scripts** (array) - Attached scripts (with `name` and `script` content) ### Response Example ```json { "data": { "id": "table-id", "header": "Customers", "items": [ { "name": "name", "header": "Name", "type": "text" }, { "name": "email", "header": "Email", "type": "email" } ], "settings": {}, "scripts": [] } } ``` ### Example: Load Table Structure ```javascript const structure = await doo.table.getTableStructure('Customers'); console.log(structure.data.items.map(f => f.name)); ``` ### Notes - Field types are returned as simple strings (e.g. 'text', 'number'). - Requires appropriate permissions to access structure data. ``` -------------------------------- ### Complex Role Condition Example Source: https://help.tabidoo.cloud/en/article/user-roles-advanced-settings Demonstrates multiple access checks including responsible person, creator, watchers (many-to-many), and department matching. ```javascript doo.model.<[Responsible person (assignedTo)]>.login === doo.currentUser.<[Login (login)]> || doo.model.<[Creator (creator)]>.value === doo.currentUser.<[Login (login)]> || doo.model.<[Watch (watch)]>.login._$$list === doo.currentUser.<[Login (login)]>.value || doo.model.<[Assigned department (assignedDepartment)]>.department === doo.currentUser.<[Department (department)]> ``` -------------------------------- ### Record Fields Example Source: https://help.tabidoo.cloud/en/article/scripting-table Specify the fields to be retrieved or modified for a record. This is a JSON object where keys are field names and values are the field data. ```json { "firstname": "Jack", "surname": "Newman" } ``` -------------------------------- ### Open Form with onInitScript Source: https://help.tabidoo.cloud/en/article/doofunctionsscripts Demonstrates using `doo.form.openForm` in conjunction with `onInitScript` for form initialization. ```javascript doo.form.openForm("form_name", { onInitScript: function(form) { // script code } }); ``` -------------------------------- ### Initialize Tabidoo Cloud Client Source: https://help.tabidoo.cloud/en/article/scripting-http-request Instantiate the Tabidoo Cloud client with authentication details and SSL options. Ensure the bearer token is valid. ```javascript const tabidoo = new Tabidoo({ bearer: '123abc', allowInvalidSSLCert: true }); ``` -------------------------------- ### Perform GET HTTP Request Source: https://help.tabidoo.cloud/en/article/scripting-http-request Use this function to perform a GET HTTP request. It can be used with or without basic authentication. ```javascript const res = await doo.functions.request.get('https://myserver.com:1234/info'); ``` ```javascript const res = await doo.functions.request.get('https://myserver.com/info', { basicAuth: { username: 'abc', password: '123'} }); ``` -------------------------------- ### Use Dynamic Environment Variables Source: https://help.tabidoo.cloud/en/article/dev-test-prod-recommended-deployment-workflow Recommended approach for generating URLs that adapt automatically to the current environment and domain. ```text ${doo.environment.domainUrl}/app/${doo.environment.currentApplication.name}/schema/asset?recordId=${doo.model.id} ``` -------------------------------- ### JavaScript Example: Setting Record Owner and Copying Status Source: https://help.tabidoo.cloud/en/article/internal-naming-of-fields This script demonstrates setting the owner of a new record to the current user and copying a system status value to a 'Status' field. It also shows how to access a custom internal name field. ```javascript // For new records, set the current user as the owner if (doo.model.ver === -1) { doo.model.owner.setValue(doo.currentUser.login); } // Copy the system status value into the Status field if (doo.model['_status']) { doo.model.status.value = doo.model['_status']; } // Store the current date and time in the Last Open field doo.model.lastOpen.setValue(new Date(new Date().toUTCString().substr(0, 25))); // Access a field with a custom internal name doo.model.personalID ``` -------------------------------- ### Custom Validation: Start Date Before End Date Source: https://help.tabidoo.cloud/en/article/doomodel Implement a custom validation rule to ensure the start date is before the end date. If the condition is not met, the form will not be saved. ```javascript // Start date must be before end date. doo.model.isValid = doo.model.startDate.value > doo.model.endDate.value); ``` -------------------------------- ### doo.functions.request.get Source: https://help.tabidoo.cloud/en/article/scripting-http-request Performs an asynchronous HTTP GET request. ```APIDOC ## GET doo.functions.request.get ### Description Performs an HTTP GET request to the specified URL. ### Method GET ### Parameters #### Path Parameters - **url** (string) - Required - The target URL for the request. #### Request Body - **options** (object) - Optional - Configuration object including headers, basicAuth, bearer, params, etc. ``` -------------------------------- ### GET doo.table.getCount Source: https://help.tabidoo.cloud/en/article/scripting-table Returns the number of records in a table that match the specified filter. ```APIDOC ## GET doo.table.getCount ### Description Returns the count of records matching the provided filter conditions without loading the full data. ### Parameters #### Path Parameters - **tableNameOrId** (string) - Required - The name or ID of the table. #### Query Parameters - **options** (object) - Optional - Filtering conditions. - **applicationId** (string) - Optional - Use to load data from a different application. ### Request Example ```javascript const result = await doo.table.getCount('Orders', { filter: 'status(eq)New' }); ``` ### Response #### Success Response (200) - **data.count** (number) - The total number of records matching the criteria. #### Response Example ```json { "data": { "count": 5 } } ``` ``` -------------------------------- ### Load XLSX Library and Convert JSON to CSV Source: https://help.tabidoo.cloud/en/article/doofunctionsscripts This example demonstrates loading the 'xlsx' library using downloadScript and then using it to convert JSON data to a CSV string. The CSV data is then saved as a file in the browser. This requires the 'xlsx' library to be compatible with both browser and server environments. ```javascript // download script // on server it just require() // in browser the script create a variable window.XLSX, which is returned const XLSX = await doo.functions.scripts.downloadScript('https://cdn.sheetjs.com/xlsx-0.19.3/package/dist/xlsx.full.min.js', 'XLSX'); // example data var data = [ { "name": "John", "city": "Seattle" }, { "name": "Zach", "city": "New York" } ]; const worksheet = XLSX.utils.json_to_sheet(data); const csvOutput: string = XLSX.utils.sheet_to_csv(worksheet); // show download file dialog doo.functions.browser.saveFile(csvOutput, 'myfile2.csv', 'text/csv'); ``` -------------------------------- ### Open a form with options Source: https://help.tabidoo.cloud/en/article/form-scripting Initialize an empty options object and open a form by table name or ID. ```typescript const options: IOpenFormOptions = {}; ... await doo.form.openForm(tableName, options); ``` -------------------------------- ### MAX - Get Maximum Date Source: https://help.tabidoo.cloud/en/article/doofunctionsdate Returns the latest of two provided date values. ```APIDOC ## MAX ### Description Returns the largest date. ### Method `doo.functions.date.max` ### Endpoint N/A (Function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **date1** (Date/string) - Required - The first date value. - **date2** (Date/string) - Required - The second date value. ### Request Example ```javascript doo.functions.date.max('2021-01-01', '2022-01-01') ``` ### Response #### Success Response (String/Date) - **Maximum Date**: The latest of the two input dates, in the same format as the input (Date or string). #### Response Example ```javascript // Returns '2022-01-01' ``` ``` -------------------------------- ### MIN - Get Minimum Date Source: https://help.tabidoo.cloud/en/article/doofunctionsdate Returns the earliest of two provided date values. ```APIDOC ## MIN ### Description Returns the lowest date. ### Method `doo.functions.date.min` ### Endpoint N/A (Function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **date1** (Date/string) - Required - The first date value. - **date2** (Date/string) - Required - The second date value. ### Request Example ```javascript doo.functions.date.min('2021-01-01', '2022-01-01') ``` ### Response #### Success Response (String/Date) - **Minimum Date**: The earliest of the two input dates, in the same format as the input (Date or string). #### Response Example ```javascript // Returns '2021-01-01' ``` ``` -------------------------------- ### GET doo.table.getData Source: https://help.tabidoo.cloud/en/article/scripting-table Retrieves a list of records from a specified table with support for filtering, sorting, and pagination. ```APIDOC ## GET doo.table.getData ### Description Loads a list of records from the specified table. Supports TypeScript generics for type-safe access. ### Parameters #### Path Parameters - **tableNameOrId** (string) - Required - The name or ID of the table. #### Query Parameters - **options** (object) - Optional - Filtering, sorting, and pagination settings. - **applicationId** (string) - Optional - Use to load data from a different application. ### Request Example ```javascript const result = await doo.table.getData('Orders', { filter: 'status(eq)New', sort: 'created(desc)', limit: 10 }); ``` ### Response #### Success Response (200) - **data** (array) - An array containing the matching records. #### Response Example ```json { "data": [ { "fields": { "status": "New", "amount": 100 } } ] } ``` ``` -------------------------------- ### Initialize Custom Input Event Listeners Source: https://help.tabidoo.cloud/en/article/advanced-fields The init script runs when the field loads. This example sets up a change event listener on the input field to update the form model's `text.value` when the input loses focus. ```javascript function setupEvents() { let titleInput = document.getElementsByClassName('TBD-RANDOM-ID-my-input1')[0] as HTMLInputElement; titleInput.addEventListener('change', (event) => { doo.model.text.value = titleInput?.value; }); } setupEvents(); ``` -------------------------------- ### Load Data from Excel, CSV, JSON via HTTP/FTP/SMB Source: https://help.tabidoo.cloud/en/article/workflow-automation Loads data from files via HTTP, FTP, SMB1, or SMB2. Requires specifying the path, credentials for FTP/SMB, and optionally adding headers for HTTP. ```N/A Controls for FTP, SMB1 or SMB2 ``` ```N/A Add header for HTTP ``` -------------------------------- ### Call async loading function Source: https://help.tabidoo.cloud/en/article/scripting-extensions Example of calling an asynchronous function to load filtered data from a table. ```typescript const orders = await doo.myLoading.tables.loadFilteredOrders(); ``` -------------------------------- ### Download External Script with downloadScript Source: https://help.tabidoo.cloud/en/article/doofunctionsscripts Use `downloadScript` to dynamically load external JavaScript libraries. Be aware of its limitations and considerations for optimal use. ```javascript downloadScript ``` -------------------------------- ### Manage Application Links with Custom Domains Source: https://help.tabidoo.cloud/en/article/custom-design-and-settings Use environment variables to ensure links remain functional across different domains and environments. ```text https://app.tabidoo.cloud/app/myapplication/schema/asset?recordId=${doo.model.id} ``` ```text ${doo.environment.domainUrl}/app/${doo.environment.currentApplication.name}/schema/asset?recordId=${doo.model.id} ``` -------------------------------- ### Options for Create, Update, Delete Source: https://help.tabidoo.cloud/en/article/scripting-table Configure options for record creation, update, and deletion functions. Includes parameters like `applicationId`, `reloadUserDataAfterAction`, `useUpsert`, and `dataResponseType`. ```json { applicationId: 'My App', // application 'My App' reloadUserDataAfterAction: false, // user data is not loaded useUpsert: true, // allow upsert mode skipAudit: true, // allows skip or force audit, otherwise table settings is used dataResponseType: 'MetadataOnly' // use 'MetadataOnly' response type } ``` -------------------------------- ### Get Thumbnail as ArrayBuffer Source: https://help.tabidoo.cloud/en/article/scripting-table Retrieves a file thumbnail as an ArrayBuffer. Requires the use of await as the operation is asynchronous. ```javascript const thumbnail = await doo.table.getThumbnail(tableNameOrId, fileId, applicationId?); ``` ```javascript const buffer = await doo.table.getThumbnail('Gallery', 'file-id'); const blob = new Blob([buffer], { type: 'image/png' }); const url = URL.createObjectURL(blob); document.getElementById('preview').src = url; ``` -------------------------------- ### Create a New Customer Record Source: https://help.tabidoo.cloud/en/article/scripting-table Use `createRecord` to insert a new record into a table. Always await this asynchronous method. It returns full record metadata and field content. ```javascript const result = await doo.table.createRecord('Customers', { firstname: 'Alice', surname: 'Smith' }); console.log(result.data.fields.firstname); ``` -------------------------------- ### Get Table Thumbnail Source: https://help.tabidoo.cloud/en/article/scripting-table Retrieves a thumbnail image of a file stored in a record. Returns binary image data. ```APIDOC ## GET /api/table/getThumbnail ### Description Loads a thumbnail image of a file stored in a record. It returns the binary image data as an `ArrayBuffer`. ### Method GET ### Endpoint `/api/table/getThumbnail` ### Parameters #### Query Parameters - **tableNameOrId** (string) - Required - The name or ID of the table containing the file. - **fileId** (string) - Required - The file’s internal ID. - **applicationId** (string) - Optional - Specify if the file belongs to another application. ### Response #### Success Response (200) - **ArrayBuffer** - Binary data of the thumbnail image. ### Response Example ``` // Example response is binary data, not a JSON object. // The actual response will be an ArrayBuffer. ``` ### Example: Display Thumbnail ```javascript const buffer = await doo.table.getThumbnail('Gallery', 'file-id'); const blob = new Blob([buffer], { type: 'image/png' }); const url = URL.createObjectURL(blob); document.getElementById('preview').src = url; ``` ### Notes - Only supported for image-based file types. - Use `await` since this is an asynchronous function. ``` -------------------------------- ### Create Development App API Call Source: https://help.tabidoo.cloud/en/article/creating-a-development-app-from-a-production-app Use this POST request to create a DEV app from an existing production app. This is useful for testing new functionality independently and implementing a proper development cycle. ```bash POST https://app.tabidoo.cloud/api/v2/templates/createDevAppFromProdApp ``` -------------------------------- ### Load Data from SQL Source: https://help.tabidoo.cloud/en/article/workflow-automation Connects to a SQL database using server name, database, and credentials. Allows loading data from stored procedures or tables. ```sql Controls for SQL ``` -------------------------------- ### POST /create-dev-app Source: https://help.tabidoo.cloud/en/article/creating-a-development-app-from-a-production-app Creates a new development version of a production application. Requires a valid Bearer token generated by the application owner. ```APIDOC ## POST /create-dev-app ### Description Creates a development version of a production application. Only technical components like Workflows, ScriptExtensions, Reports, CustomDataSources, Roles, and SystemLogParameters are copied; user data is not transferred. ### Authorization Requires a Bearer token created under the application owner account. Set the header: `Authorization: Bearer your-api-token`. ### Request Body - **applicationId** (string) - Required - The unique ID of the production application. - **overrideExistingTemplateId** (string) - Optional - Used to force creation if the app was from a template or a DEV version already exists. ### Request Example { "applicationId": "abc12345-048e-4ada-ae48-2ffd531cdcdc", "overrideExistingTemplateId": "12345678-1234-4123-1234-123456789123" } ``` -------------------------------- ### Get Table Thumbnail Base64 Source: https://help.tabidoo.cloud/en/article/scripting-table Retrieves a thumbnail image of an uploaded file and returns its base64-encoded content along with metadata. ```APIDOC ## GET /api/table/getThumbnailBase64 ### Description Retrieves a thumbnail image of an uploaded file and returns its base64-encoded content along with metadata. ### Method GET ### Endpoint `/api/table/getThumbnailBase64` ### Parameters #### Query Parameters - **tableNameOrId** (string) - Required - The name or ID of the table containing the file. - **fileId** (string) - Required - The file’s internal ID. - **applicationId** (string) - Optional - Specify if the file belongs to another application. ### Response #### Success Response (200) - **IDooGetFileBase64** - An object containing: - **content** (string) - Base64 encoded thumbnail image. - **fileName** (string) - Name of the file. - **mimeType** (string) - MIME type of the thumbnail (e.g., `image/jpeg`). - **fileSize** (number) - Size of the thumbnail in bytes. ### Response Example ```json { "content": "/9j/4AAQSkZJRgABAQEASABIAAD...", "fileName": "thumbnail.jpg", "mimeType": "image/jpeg", "fileSize": 10240 } ``` ### Example: Show Thumbnail in Image Element ```javascript const thumb = await doo.table.getThumbnailBase64('Images', 'file-id'); document.getElementById('thumb').src = `data:${thumb.mimeType};base64,${thumb.content}`; ``` ### Notes - Only supported for image-based file types. - Use `await` since this is an asynchronous function. ``` -------------------------------- ### Mutation Options Source: https://help.tabidoo.cloud/en/article/scripting-table Configuration for write operations like create, update, and delete. ```APIDOC ## Mutation Options ### Request Body - **applicationId** (string) - Optional - Target application ID. - **reloadUserDataAfterAction** (boolean) - Optional - Whether to reload user data. - **useUpsert** (boolean) - Optional - Enable upsert mode. - **skipAudit** (boolean) - Optional - Skip or force audit logs. - **dataResponseType** (string) - Optional - Response format (e.g., 'MetadataOnly'). ### Request Example { "applicationId": "My App", "reloadUserDataAfterAction": false, "useUpsert": true, "skipAudit": true, "dataResponseType": "MetadataOnly" } ``` -------------------------------- ### Get Current Record ID Source: https://help.tabidoo.cloud/en/article/doomodel Retrieve the internal unique identifier for the current record. Useful for referencing the record in other operations. ```javascript const recordId = doo.model.id; ``` -------------------------------- ### async openForm(tableNameOrId, options?) Source: https://help.tabidoo.cloud/en/article/form-scripting Opens an input form for a specified table. The form's onInitScript is executed automatically upon opening. ```APIDOC ## async openForm(tableNameOrId, options?) ### Description Opens an input form for the table (use table name or id). Options and applicationId are optional. ### Parameters #### Path Parameters - **tableNameOrId** (string) - Required - The name or ID of the table to open. #### Request Body - **options** (IOpenFormOptions) - Optional - Configuration object for the form. - **model** (object) - Optional - Data to prefill the form. Use { id: ... } for linked fields. - **header** (string) - Optional - Custom title for the form. - **fields** (IField[]) - Optional - Array of field definitions to create a custom form. - **saveButtonCallback** (function) - Optional - Async function executed on save; return true to close the form. ### Request Example ```javascript const options = { model: { name: 'Peter' }, header: 'People' }; await doo.form.openForm('tableName', options); ``` ``` -------------------------------- ### Get Table Structure Source: https://help.tabidoo.cloud/en/article/scripting-table Loads the full schema of a table, including fields and scripts. Useful for dynamic UI generation or debugging. ```javascript const structure = await doo.table.getTableStructure(tableNameOrId, applicationId?); ``` ```javascript const structure = await doo.table.getTableStructure('Customers'); console.log(structure.data.items.map(f => f.name)); ``` -------------------------------- ### Get Thumbnail as Base64 Source: https://help.tabidoo.cloud/en/article/scripting-table Retrieves a thumbnail with metadata including MIME type and file name. The result is returned as a base64-encoded string. ```javascript const thumbnail = await doo.table.getThumbnailBase64(tableNameOrId, fileId, applicationId?); ``` ```javascript const thumb = await doo.table.getThumbnailBase64('Images', 'file-id'); document.getElementById('thumb').src = `data:${thumb.mimeType};base64,${thumb.content}`; ``` -------------------------------- ### Scripting Objects - Environment Source: https://help.tabidoo.cloud/en/article/dooenvironment Information about the Tabidoo environment, including details about the current application and its properties. ```APIDOC ## doo.environment ### Description Information about the Tabidoo environment. ### Properties - **currentApplication** (object) - Information about the current application. Its id, name, current table, params, etc. ### Examples ```javascript // Get current application details let appInfo = doo.environment.currentApplication; // Get current table details let currentTable = doo.environment.currentApplication.currentTable; // Get currently selected records let selectedRecords = doo.environment.currentApplication.currentTable.selectedRecords; // Get current user data filter let userDataFilter = doo.environment.currentApplication.currentTable.dataConditions; ``` ``` -------------------------------- ### Get Absolute Value - Tabidoo Script Source: https://help.tabidoo.cloud/en/article/doofunctionsmath Use `doo.functions.math.abs` to return the absolute value of a number. The result can be assigned to a model field. ```javascript const x = doo.functions.math.abs(-50); doo.model.number.value = x; // 50 ``` -------------------------------- ### Implement formatting script Source: https://help.tabidoo.cloud/en/article/scripting-extensions Implementation of the formatting logic returning a date range string. ```typescript const ret = { getTitle2Days: (dateFrom: Date, dateTo: Date, locale: string) => { return `${dateFrom.toLocaleDateString(locale)} - ${dateTo.toLocaleDateString(locale)}`; } }; return ret; ```