Category: Script Library
TF API Extensions
This script adds methods that extend the standard TapForms Pro Javascript API.
Provided methods:
| Function | Description | Return Value | Example |
|---|---|---|---|
| DOCUMENT | |||
| getScriptNamed(name) | Returns the document script with the given name. name: the name of the script to fetch. |
script | var scr = document.getScriptNamed("Add Client"); |
| getScriptWithId(id) | Returns the document script with the given id. | script | var scr = document.getScriptWithId(script_id); |
| FORM | |||
| getRecordWithMatch(field_id, value) | Returns the first record where the specified field matches the given value. field_id: the id of the field to match; value: the value to match. |
record | var rec = form.getRecordWithMatch(field_id, value); |
| fetchRecordsWithMatch(field_id, value) | Returns all records where the specified field matches the given value. field_id: the id of the field to match; value: the value to match. |
array of records | var recs = form.fetchRecordsWithMatch(field_id, value); |
| fetchSearches() | Returns all search objects of the given form (including searches inside saved search directories). | array | var searches = form.fetchSearches(); |
| getScriptWithId(id) | Returns the script with the given id. | script | var scr = form.getScriptWithId(id); |
| selectLayoutNamed(layoutName) | Selects the layout with the given name. | — | form.selectLayoutNamed("My Layout"); |
| lockAll() | Locks all records in the given form and saves changes. | — | form.lockAll(); |
| unlockAll() | Unlocks all records in the given form and saves changes. | — | form.unlockAll(); |
| RECORD | |||
| fetchLinkedFieldValues(link_id, id) | Returns the values of the linked field with the given id. link_id: the id of the link field; id: the id of the field in the linked form to fetch values from. |
array | var values = record.fetchLinkedFieldValues(link_id, field_id); |
| refreshAndSaveAllChanges() | Refreshes all calculations of the record and saves all changes. | — | record.refreshAndSaveAllChanges(); |
| recalculateAllCalculations() | Recalculates all calculation and script fields on the record. | — | record.recalculateAllCalculations(); |
| getFieldIdNamed(name) | Returns the id of the field with the given name. If no field matches, logs an error and returns nothing. name: the field name to look up. |
field id | var fieldId = record.getFieldIdNamed("Field Name"); |
| getFieldValueWithName(name) | Returns the value for the field with the given name. | (field value) | var v = record.getFieldValueWithName("Field Name"); |
Usage
This script is a helper script that is launched from other applications. It doesn't do anything on it's own.
To use the features this script provides, include it with
document.getFormNamed('Scripts').runScriptNamed('TF API Extensions');
Installation
The TF API Extensions script is installed using the scriptHandler script about which you can learn more over here. It is installed in the Scripts form.
Dependencies
none
ChangeLog
Link to ChangeLog
Author
- Daniel Leu, info@danielleu.com
Do you like this script? Are you using it? Please consider supporting me by buying me a coffee!
Thanks!
Last modified: Apr 5, 2026 12:40:18 AM
Browse posts:
