commandArgs variable.
All variables in this section are global and visible across the entire program.
Field paths
Some functions take the path to a field as an input parameter. The path comprises the field name and the names of its parent elements (field group, section). For tables, repeating tables, and repeating groups, specify the instance number starting at0 (zero).
For example, ['Document Section 1', 'Group[10]', 'Field3'], where [10] is the number of the instance of the repeating group.
Functions for working with fields
getCurrentField
getCurrentField()
Returns a link to the field object that uses the current custom script.
getFieldByName
getFieldByName(namesPath)
Returns a link to the field for which the custom script has been opened.
getFieldValue
getFieldValue(namesPath)
Returns the field value: a string for a TextField field, a checkmark value for a Checkmark field, or a string array for a Checkmark Group field.
setCurrentFieldValue
setCurrentFieldValue(value, forced, onSaved)
Modifies the value of the field for which the custom script has been opened.
setFieldValue
setFieldValue(namesPath | field, value, forced, onSaved)
Modifies the field value.
save
save()
Closes the window where the custom script is executed and saves the changes.
cancel
cancel()
Closes the window where the custom script is executed without saving the changes.
Functions for working with data sets
addEntity
addEntity(entityInfo: {cacheName, columns, values}, onResult(newId))
Adds an entry to the data set.
editEntity
editEntity(entityInfo: {cacheName, columns, values}, onResult())
Edits an entry in the database.
getDict
getDict({cacheName, filters: [{FieldName, FieldValue}], cursorPos, allowMultipleColumnResults}, onResult(param: {FieldName, FieldValue, BoldMask}[][]))
Searches the data set for a specified value or part of it.
BoldMask is a string of 0 and 1 the same length as the value found. 1 marks a symbol from the found value that matches the corresponding symbol in the search field, and 0 marks one that does not.
For example, if a data set contains CompanyName: ABBYY and a search is carried out for the symbols ABB, the following is returned:
BoldMask value in descending order, starting with the strings that best match the search conditions.
getDictAll
getDictAll({cacheName, filters: {FieldName, FieldValue}}, }, onResult(param: {FieldName, FieldValue, BoldMask}[][]))
Searches the database for the entire value specified. Returns the values of all fields that were found.
BoldMask is a string of 0 and 1 the same length as the value found. 1 marks a symbol from the found value that matches the corresponding symbol in the search field, and 0 marks one that does not.
For example, if a data set contains CompanyName: ABBYY and a search is carried out for the symbols ABB, the following is returned:
BoldMask value in descending order, starting with the strings that best match the search conditions.
For a full example, see Sample database search script.
Functions for working with the document form
selectRow
selectRow(tablePath, rowNumber)
Marks a table row as selected.
deselectRow
deselectRow(tablePath, rowNumber?)
Removes the selection from a table row.
scrollFormToField
scrollFormToField(namesPath)
Scrolls the form editor to bring the field into view.
getDomElementPosition
getDomElementPosition(domId, onResult: (result?: {width, height, top, left, right, bottom}))
Gets the position of an element in the form editor window and returns the result of a callback function.
setStyles
setStyles(styles, callback)
Adds CSS styles to the custom action frame window.
commandArgs object
Variables
Events
Field object types
Custom scripts can access the following field object types and the document object. Every field object exposes the Region object through itsRegions property.
Field Group field
Section field
Table field
Row object
Text entry field
TextType values
Checkmark field
Checkmark Group field
Picture field
Repeating Group of Sections field
Region object
TheRegions property of every field object returns an array of regions with the following structure.
Document object
The document object is available throughcommandArgs.params.document.
