| Function/Property |
U |
Parameters |
Returns |
Description |
Example |
| addNewScriptNamed() |
x |
|
|
|
|
| createNewFormNamed() |
|
text |
form |
Call this to create a new form with the specified name. |
document.createNewFormNamed('My New Form'); |
| deleteScript() |
x |
|
|
|
|
| fetchCategories() |
x |
|
|
|
|
| fetchForms() |
x |
|
|
|
|
| fetchPickLists() |
x |
|
|
|
|
| fetchScripts() |
x |
|
|
|
|
| getCategoryNamed() |
x |
|
|
|
|
| getFormIdsByName() |
|
text |
array |
Returns the list of form IDs for the specified form name. |
document.getFormIdsByName('Movies'); |
| getFormNamed() |
|
text |
form |
Call this to fetch a form with the specified name. |
document.getFormNamed('My Movie Library'); |
| getFormWithId() |
|
form ID |
form |
Call this to get a form with the specified form ID. |
document.getFormWithId('frm-1234567890abcdef'); |
| getForms() |
|
none |
array of forms |
Call this to fetch an array of all the forms in your database document. |
document.getForms(); |
| getId() |
|
none |
text |
Returns the ID of the current document |
document.getId(); |
| getPickListNamed() |
|
text |
Pick List |
Call this to fetch a Pick List with the specified name. |
document.getPickListNamed('Priorities'); |
| getPickLists() |
|
none |
array of Pick List |
Call this to fetch the list of Pick Lists in the database. |
document.getPickLists(); |
| getUrl() |
x |
|
|
|
|
| name |
|
none |
text |
Returns the name of the document. |
document.name; |
| runScriptNamed() |
x |
|
|
|
|
| saveAllChanges() |
|
none |
Bool |
Call this to save any changes your script has made to the database document. |
document.saveAllChanges(); |
| saveAllChangesAndRefresh() |
x |
|
|
|
|
| selectFormLayout() |
|
form ID, layout ID |
none |
Selects a form and a specific layout. Pass null for the layout ID to select the Default Layout |
document.selectFormLayout(form_id, layout_id); |
| Function/Property |
U |
Parameters |
Returns |
Description |
Example |
| addField() |
|
Field |
none |
Adds the specified Field to the form. |
form.addField(field); |
| addNewFieldNamedWithType() |
|
name, type (text, number, calc, location, photo) |
Field |
Adds a new field to the form with the specified name and field type. |
var field = form.addNewFieldNamedWithType('Quantity', 'number'); |
| addNewRecord() |
|
none |
record |
Adds a new record to the form. |
var newRecord = form.addNewRecord(); |
| addNewRecordWithId() |
x |
|
|
|
|
| addNewScriptNamed() |
|
text |
Script |
Adds a new Script to the form. |
var newScript = form.addNewScriptNamed("My Script"); |
| deleteField() |
x |
|
|
|
|
| deleteRecord() |
|
record |
error string |
Deletes the specified record from the form. |
form.deleteRecord(someRecord); |
| deleteScriptNamed() |
|
text |
error string |
Deletes the first Script with the specified name from the form. |
form.deleteScriptNamed("My Script"); |
| deleteScriptWithId() |
|
text |
error string |
Deletes the Script with the specified ID from the form. |
form.deleteScriptWithId("scr-blahblah"); |
| fetchFieldIds() |
|
none |
array |
Returns an array of all the field IDs in the form. |
form.fetchFieldIds(); |
| fetchFields() |
|
none |
array |
Returns an array of all the TFField objects in the form. |
form.fetchFields(); |
| fetchFieldsForType() |
|
type (text, number, check_mark, date, time, date_time, calc, note, etc.) |
array |
Returns an array of all the TFField objects in the form for the specified type. |
form.fetchFieldsForType('text'); |
| fetchLayouts() |
|
none |
array of layouts |
Returns all the layouts for the form. |
form.fetchLayouts(); |
| fetchPickLists() |
|
none |
array |
Returns an array of CDPickList objects for the specified form. |
var pickLists = form.fetchPickLists(); |
| fetchRecords() |
|
none |
array |
Returns an array of record objects for the specified form. |
var records = form.fetchRecords(); |
| fetchRecordsForSearchTerm() |
|
text, field ID |
array |
Returns an array of record objects for the specified search term found within the specified field. |
var records = form.fetchRecordsForSearchTerm("search term", some_field_id); |
| fetchRecordsForSearchTermFieldId() |
x |
|
|
|
|
| fetchScripts() |
|
none |
array of Script |
Returns the array of Script objects in the form. |
form.fetchScripts(); |
| formCategory |
x |
|
|
|
|
| formDescription |
x |
|
|
|
|
| getAvgOfField() |
|
field ID |
number |
Returns the average value of all the records in the form for the specified field. |
form.getAvgOfField(fieldID); |
| getFieldIds() |
|
none |
array |
Returns an array of all the field IDs in the form. |
form.getFieldIds(); |
| getFieldNamed() |
|
text |
Field |
Returns the TFField object for the specified field name. |
form.getFieldNamed('Movie Title'); |
| getFieldWithId() |
|
field ID |
Field |
Returns the TFField object for the specified field ID. |
form.getFieldWithId('fld-abcde1234'); |
| getFields() |
|
none |
array |
Returns an array of all the TFField objects in the form. |
form.getFields(); |
| getFieldsForType() |
|
type (text, number, check_mark, date, time, date_time, calc, note, etc.) |
array |
Returns an array of all the TFField objects in the form for the specified type. |
form.getFieldsForType('text'); |
| getId() |
|
none |
form ID |
Returns the internal unique ID of the form. |
form.getId(); |
| getLayoutNamed() |
|
text |
Layout |
Returns the TFFormLayout object for the specified layout name. |
form.getLayoutNamed('Print Layout'); |
| getLayoutWithId() |
|
layout ID |
Layout |
Returns the TFFormLayout object for the specified layout ID. |
form.getLayoutWithId(layout_id); |
| getLayouts() |
|
none |
array of layouts |
Returns all the layouts for the form. |
form.getLayouts(); |
| getMaxOfField() |
|
field ID |
number |
Returns the maximum value of all the records in the form for the specified field. |
form.getMaxOfField(fieldID); |
| getMinOfField() |
|
field ID |
number |
Returns the minimum value of all the records in the form for the specified field. |
form.getMinOfField(fieldID); |
| getPickListNamed() |
x |
|
|
|
|
| getRecordWithId() |
|
record ID |
record |
Returns the record for the specified record ID. |
form.getRecordWithId('rec-123456789abcdef'); |
| getRecords() |
|
none |
array |
Returns an array of record objects for the specified form. |
var records = form.getRecords(); |
| getRecordsForSearchTerm() |
|
text |
array |
Returns an array of record objects for the specified search term. |
var records = form.getRecordsForSearchTerm("search term"); |
| getScriptNamed() |
|
text |
Script |
Returns the first Form Script with the specified name. |
form.getScriptNamed("My Script"); |
| getScriptWithId() |
x |
|
|
|
|
| getScripts() |
|
none |
array of Script |
Returns the array of Script objects in the form. |
form.getScripts(); |
| getSearchNamed() |
|
text |
Search |
Returns a search object given the name of a search. |
form.getSearchNamed('Genre: Action & Adventure'); |
| getTotalOfField() |
|
field ID |
number |
Returns the total sum of all the records in the form for the specified field. |
form.getTotalOfField(fieldID); |
| groupField |
x |
|
|
|
|
| groupFieldDirection |
x |
|
|
|
|
| language |
x |
|
|
|
|
| name |
|
none |
text |
Returns the name of the form. |
form.name; |
| recordCount |
x |
|
|
|
|
| runScriptNamed() |
|
text |
none |
Runs the Form Script with the specified name. Used for including scripts inside other scripts. |
form.runScriptNamed('Common Functions'); |
| saveAllChanges() |
|
none |
Bool |
Call this to save any changes your script has made to the database document. |
form.saveAllChanges(); |
| selectRecord() |
|
record |
none |
Selects the specified record on the form. |
form.selectRecord(someRecord); |
| sortField1 |
x |
|
|
|
|
| sortField1Direction |
x |
|
|
|
|
| sortField2 |
x |
|
|
|
|
| sortField2Direction |
x |
|
|
|
|
| sortField3 |
x |
|
|
|
|
| sortField3Direction |
x |
|
|
|
|
| sortOrder |
x |
|
|
|
|
| sortedLayouts |
x |
|
|
|
|
| sortedSearches |
x |
|
|
|
|
| Function/Property |
U |
Parameters |
Returns |
Description |
Example |
| addFileFromUrlToField() |
|
url, field_id |
none |
Fetches a file from the specified URL and adds it to the File Attachment field specified by field_id. The file can be a local file URL on disk in the Mac version when you have the Script Folder specified on the General Preferences window. |
record.addFileFromUrlToField(file_url, file_field_id) |
| addNewRecordToField() |
|
field_id |
record |
Used for adding a new record to a Link to Form or Table field. |
var newRecord = record.addNewRecordToField(field_id); |
| addPhotoFromUrlToField() |
|
url, field_id |
none |
Fetches a photo from the specified URL and adds it to the Photo field specified by field_id |
record.addPhotoFromUrlToField(image_url, case_cover_id) |
| addRecordToField() |
|
record, field_id |
none |
Used for adding an existing record to a Link to Form or Table field. |
record.addRecordToField(someRecord, field_id); |
| copyMediaToField() |
|
media, field_id |
none |
Used for copying an existing CDMedia object to another field. |
record.copyMediaToField(someMedia, field_id); |
| dateCreated |
|
none |
date |
Returns the date the record was created. |
var created = record.dateCreated; |
| dateModified |
|
none |
date |
Returns the date the record was modified. |
var modified = record.dateModified; |
| deleteAllMediaFromField() |
x |
|
|
|
|
| description |
x |
|
|
|
|
| description() |
x |
|
|
|
|
| deviceName |
|
none |
text |
Returns the name of the device that modified the record last. |
var device = record.deviceName; |
| duplicate() |
|
none |
record |
Returns a new copy of the record. |
var copyOfRecord = record.duplicate(); |
| fetchMediaForField() |
|
field_id |
array of CDMedia |
Fetches a list of CDMedia objects from the record for the specified field. |
record.fetchMediaForField(field_id); |
| form |
|
none |
Form |
Returns the form this record belongs to. |
record.form; |
| getAvgOfLinkedFieldForField() |
|
linked field ID, field ID |
number |
Returns the average of all the records in the linked field for the specified field. |
record.getAvgOfLinkedFieldForField(linkedFieldID, fieldID); |
| getFieldValue() |
|
field_id |
object |
Gets the value for the specified field from the record. The return type depends on the field you’re getting the value from. |
var barcode = record.getFieldValue(barcode_id); |
| getId() |
|
none |
record ID |
Returns the internal unique ID of the record. |
record.getId(); |
| getLinkedRecordsForField() |
x |
|
|
|
|
| getMaxOfLinkedFieldForField() |
|
linked field ID, field ID |
number |
Returns the maximum value of all the records in the linked field for the specified field. |
record.getMaxOfLinkedFieldForField(linkedFieldID, fieldID); |
| getMinOfLinkedFieldForField() |
|
linked field ID, field ID |
number |
Returns the minimum value of all the records in the linked field for the specified field. |
record.getMinOfLinkedFieldForField(linkedFieldID, fieldID); |
| getNoteFieldValue() |
|
field_id |
note value |
Gets the rich text note field value from the specified Note field. |
record.getNoteFieldValue(field_id'); |
| getRecordColor() |
|
none |
web hex color |
Gets the web hex colour value for the record. |
var color = record.getRecordColor(); |
| getTotalOfLinkedFieldForField() |
|
linked field ID, field ID |
number |
Returns the total sum of all the records in the linked field for the specified field. |
record.getTotalOfLinkedFieldForField(linkedFieldID, fieldID); |
| getUrl() |
|
none |
url |
Gets the URL for the record. This is the same URL as the Copy Record Link function under the Edit menu. |
record.getUrl(); |
| parentRecord |
x |
|
|
|
|
| recordExistsInField() |
|
record, field_id |
boolean |
Returns true if the record exists in the Link to Form or Table field. |
record.recordExistsInField(childRecord, field_id'); |
| refreshCalculations() |
|
none |
none |
Allows you to rerun calculations and scripts for the record. |
record.refreshCalculations(); |
| removeRecordFromField() |
|
record, field_id |
none |
Removes a record from a Link to Form or Table field. |
record.removeRecordFromField(childRecord, field_id'); |
| setFieldIfEmptyValue() |
x |
|
|
|
|
| setFieldValue() |
|
field_id, value, boolean |
none |
Sets the value on the specified field. When the optional third parameter is false, scripts that run by default are disabled. |
record.setFieldValue(movie_title_id, 'The Terminator', false); |
| setFieldValue() |
|
field_id, value, boolean |
none |
Sets the value on the specified field. When the optional third parameter is false, scripts that run by default are disabled. |
record.setFieldValue(movie_title_id, 'The Terminator', false); |
| setFieldValues() |
|
dictionary, boolean |
none |
Sets the values on multiple fields at once given a dictionary of field ids and values. Second boolean parameter optionally disables scripts that would run by default if the parameter is false. |
record.setFieldValues({
[field1_id]: "value1",
[field2_id]: "value2",
[field3_id]: "value3"
}, false); |
| setNoteFieldValue() |
|
field_id, value |
none |
Sets the rich text note field value on the specified Note field. |
record.setNoteFieldValue(field_id, 'note_value'); |
| setRecordColor() |
|
web color |
none |
Sets the color for the record to the specified web hex color. |
record.setRecordColor('#cc9900'); |
| updateCalculationResultForField() |
x |
|
|
|
|
| values |
|
none |
dictionary |
Returns the values in dictionary format that are associated with this record. The key in the dictionary is the field ID. |
record.values; |
| Function/Property |
U |
Parameters |
Returns |
Description |
Example |
| addToCalendar() |
|
dictionary, start date, end date |
event identifier |
Adds an event given the specified start date, end date, and event info dictionary. |
See example below |
| addToReminders() |
|
dictionary, due date |
none |
Adds a reminder to the Apple Reminders for the specified reminder dictionary and due date. |
See example below |
| alertWithMessage() |
|
title, message |
none |
Displays an alert with the specified title and message |
Utils.alertWithMessage('Script Run Complete!', 'Cool!!!!!'); |
| appendTextToFileHandle() |
x |
|
|
|
|
| closeFileWithHandle() |
x |
|
|
|
|
| contentsOfDirectoryAtUrl() |
x |
|
|
|
|
| copyHtmlFromClipboard() |
x |
|
|
|
|
| copyTextFromClipboard() |
|
none |
text |
Returns whatever text is on the clipboard. |
Utils.copyTextFromClipboard() |
| copyTextToClipboard() |
|
text |
none |
Copies the specified text to the clipboard. |
Utils.copyTextToClipboard('Some text') |
| createDirectoryAtUrl() |
x |
|
|
|
|
| decodeBase64String() |
x |
|
|
|
|
| deepSeekApiKey() |
x |
|
|
|
|
| deleteFileAtUrl() |
x |
|
|
|
|
| encodeBase64String() |
x |
|
|
|
|
| fileExistsAtUrl() |
x |
|
|
|
|
| getAppVersion() |
x |
|
|
|
|
| getBuildNumber() |
x |
|
|
|
|
| getCalendarNames() |
x |
|
|
|
|
| getDataFromUrl() |
|
url |
binary data |
For the specified URL, returns a binary data response. |
var photo_data = Utils.getDataFromUrl(url); |
| getDeviceName() |
|
text |
none |
Returns the name of the device. |
var device_name = Utils.getDeviceName(); |
| getJsonFromUrl() |
|
url |
JSON |
For the specified URL, returns a JSON response that you can get values from. |
var product_info = Utils.getJsonFromUrl(url); |
| getJsonFromUrlWithHeaders() |
x |
|
|
|
|
| getReminderNames() |
x |
|
|
|
|
| getTextFromUrl() |
|
url |
text |
For the specified URL, returns a text response. |
var product_info = Utils.getTextFromUrl(url); |
| getUrlsFromFolder() |
x |
|
|
|
|
| getUserName() |
|
text |
none |
Returns the name of the user logged in to the device. For iOS, returns “Mobile User” |
var user_name = Utils.getUserName(); |
| getUuid() |
x |
|
|
|
|
| gptApiKey() |
x |
|
|
|
|
| makeHTTPRequest() |
|
url, string or data, dictionary, string |
JSON dictionary |
Returns a JSON dictionary response for the HTTP request. |
var result = Utils.makeHTTPRequest(url, body, headers, method); |
| openTextFileAtUrl() |
x |
|
|
|
|
| openUrl() |
|
url |
none |
For the specified URL, calls the operating system to open it. |
Utils.openUrl(url); |
| postContentToUrlWithContentType() |
|
text, url, content type |
dictionary |
For the specified URL, posts the text content using the specified content type. |
Utils.postContentToUrlWithContentType(some_string, url, 'application/json'); |
| postContentToUrlWithHeaders() |
x |
|
|
|
|
| postJsonToUrl() |
|
JSON, url |
dictionary |
For the specified URL, posts the JSON content. |
Utils.postJsonToUrl(json_string, url); |
| printRecordsShowPanel() |
|
boolean |
none |
When true passed in, shows the print panel before printing records. When false is passed in, prints the current view without showing the print panel. |
Utils.printRecordsShowPanel(true); |
| promptForInputParametersFunction() |
x |
|
|
|
|
| refreshRecords() |
x |
|
|
|
|
| runAppleScript() |
x |
|
|
|
|
| scriptAccessFolder() |
x |
|
|
|
|
| showConsole() |
x |
|
|
|
|
| trashFileAtUrl() |
x |
|
|
|
|
| updateCalendarEvent() |
|
string, dictionary, start date, end date |
none |
Given an event identifier previously provided when adding an event, update the event information. |
See example below |
| updateReminder() |
|
string, dictionary, due date |
none |
Given a reminder identifier previously provided when adding a reminder, update the reminder information. |
See example below |
| writeDataToUrl() |
x |
|
|
|
|
| writeTextToUrl() |
x |
|
|
|
|