Objects
Below is a list of functions that are available for creating custom scripts. To access object instances, use the commandArgs variable.
All variables in this section are global and are visible across the entire program.
Functions for working with fields
Function | Description |
---|---|
getCurrentField() | Returns a link to the field object that uses the current custom script. |
getFieldByName(namesPath) (*) |
Returns a link to the field for which the custom script has been opened. Example:
|
getFieldValue(namesPath) (*) |
Returns:
namesPath | fieldObject:
|
setCurrentFieldValue(value, forced, onSaved) |
Modifies the field value for which the custom script has been opened. Parameters:
|
setFieldValue(namesPath | field, value, forced, onSaved) (*) |
Modifies the field value. Parameters:
|
save() | Closes the window where the custom script is executed and saves the changes. |
cancel() | Closes the window where the custom script is executed without saving the changes. |
(*) For some functions listed above, the path to the field is specified as an input parameter. It comprises the field name and the names of the parent elements (field group, section). For tables, repeating tables, and repeating groups, you need to specify the instance number starting at 0 (zero). Example: where [10] is the number of the instance of the repeating group. |
Functions for working with data sets
Function | Description |
---|---|
addEntity(entityInfo: {cacheName, columns, values}, onResult(newId)) |
Adds an entry to the data set. Parameters:
|
editEntity(entityInfo: {cacheName, columns, values}, onResult()) |
Edits an entry in the database. Parameters:
|
getDict({cacheName, filters: [{FieldName, FieldValue}], cursorPos, allowMultipleColumnResults}, onResult (param: { FieldName, FieldValue, BoldMask}[][]) ) |
Carries out a data set search for a specified value or for a part of it. Returns the matching strings in the following format: [{FieldName Parameters:
If, for example, the following is present in a data set: CompanyName: ABBYY Let's assume that a search is carried out for the symbols "ABB". Then, the following will be returned: [ [ { FieldName: ‘CompanyName’, FieldValue: ‘ABBYY’, BoldMask: ‘11100’ }, ] ] Note: The returned array can contain several values, including those that did not initially fit the search conditions. The search results in the array will be sorted by BoldMask parameter value in descending order (i.e. starting with strings that best match the search conditions). |
getDictAll({cacheName, filters: {FieldName, FieldValue}}, }, onResult (param: { FieldName, FieldValue, BoldMask}[][])) |
Carries out a database search for the entire value specified. Returns the values of all fields that have been found. Parameters:
[ [ { FieldName: ‘CompanyName’, FieldValue: ‘ABBYY’, BoldMask: ‘11100’ }, ] ] Note: The returned array can contain several values, including those that did not initially fit the search conditions. The search results in the array will be sorted by BoldMask parameter value in descending order (i.e. starting with strings that best match the search conditions). |
Sample database search script |
Functions for working with the document form
Function | Description |
---|---|
selectRow(tablePath, rowNumber) (*) |
Marks a table row as selected.
|
deselectRow(tablePath, rowNumber?) (*) |
Removes selection from a table row.
|
scrollFormToField(namesPath) (*) |
Scrolls the form editor to get the field into view.
|
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(styles, callback) |
Adds CSS styles to the custom action frame window.
|
(*) For some functions listed above, the path to the field is specified as an input parameter. It comprises the field name and the names of the parent elements (field group, section). For tables, repeating tables, and repeating groups, you need to specify the instance number starting at zero. Example: where [10] is the number of the instance of the repeating group. |
Properties of the commandArgs object
Variables
Variable | Type | Description |
---|---|---|
commandArgs.params.document | Document | Stores an object copy of an open document. This can be used to get access to any error, field, or region for the current document. |
commandArgs.params.currentField | (Picture | Checkmark | Checkmark Groups | FieldsGroup | Table | TextField) |
Returns a link to a field object that reflects the state of the field at the time when the script is called. Part of the document specified above. Note: If the field value was modified after the script was initialized, the changes will not be applied. |
commandArgs.params.appPath | String | The server's domain name. |
commandArgs.params.coordinates | Object [{X1,X2,Y1,Y2}] |
The coordinates of the DOM element that called the custom script. |
commandArgs.params.currentElementDomId | String | The ID of the DOM element that called the custom script. |
Functions
Function | Description |
---|---|
commandArgs.events.addEventHandler | Adds an event handler in the global context of the custom script. |
commandArgs.events.triggerHandlers | Triggers an event in the global context of the custom script. |
commandArgs.events.removeEventHandler | Deletes an event handler in the global context of the custom script. |
Field Group field
Name | Type | Rights | Description |
---|---|---|---|
Fields | (Picture | Checkmark | Checkmark Groups | FieldsGroup | Table | TextField)[] | Read-only | Array of fields |
HasTableLayout | Boolean | Read-only | Specifies if the field region is a table. |
Caption | String | Read-only | Custom field name, caption |
FieldType | Number | Read-only |
Field type. Possible value: 4 – field group |
Id | Number | Read-only | Field ID |
IsReadOnly | Boolean | Read-only | Specifies whether editing of fields is disallowed. |
IsVisible | Boolean | Read-only | Specifies whether the field is visible on the data form. |
MaxRegions | Number | Read-only | Maximum number of field regions. If the value is -1, any number of regions is allowed. |
Name | String | Read-only | Service name for the field. |
NamePath | String[] | Read-only | Array of field and group names that form the path to the field. |
NeedRecognize | Boolean | Read/write | Specifies whether to retrieve the field value from the region when the rules are checked again. |
Regions | { Id: number; Status: number; PageId: Number; IsNew : Boolean; Coordinates: Object [{X1,X2,Y1,Y2}]; }[] |
Read-only |
Array of regions.
|
Section field
Name | Type | Rights | Description |
---|---|---|---|
Fields | (Picture | Checkmark | Checkmark Groups | FieldsGroup | Table | TextField)[] | Read-only | Array of fields |
Pageids | Number[] | Read-only | Identifiers of the pages on which the section is located. |
IsFlexible | Boolean | Read-only | Specifies whether the section is flexible. |
Caption | String | Read-only | Custom field name, caption |
FieldType | Number | Read-only |
Field type. Possible value: 6 – section |
Id | Number | Read-only | Field ID |
IsReadOnly | Boolean | Read-only | Specifies whether field editing is disallowed |
IsVisible | Boolean | Read-only | Specifies whether the field is visible on the data form. |
MaxRegions | Number | Read-only | Maximum number of field regions. If the value is -1, any number of regions is allowed. |
Name | String | Read-only | Service name of the field |
NamePath | String[] | Read-only | Array of field and group names that form the path to the field. |
NeedRecognize | Boolean | Read/write | Specifies whether to retrieve the field value from the region when the rules are checked again. |
Regions | { Id: number; Status: number; PageId: Number; IsNew : Boolean; Coordinates: Object [{X1,X2,Y1,Y2}]; }[] |
Read-only |
Array of regions.
|
Table field
Name | Type | Rights | Description |
---|---|---|---|
Rows | { Id: number; RowNumber: number; HasColorImage: boolean; TableBlockID: number[]; Cells: (Picture | Checkmark | CheckmarkGroup | TextField)[]; }[] |
Read-only |
List of table rows. The parameters of the object line in the table:
|
Caption | String | Read-only | Custom field name, caption |
FieldType | Number | Read-only |
Field type. Possible value: 7 – table |
Id | Number | Read-only | Field ID |
IsReadOnly | Boolean | Read-only | Specifies whether field editing is disallowed. |
IsVisible | Boolean | Read-only | Specifies whether the field is visible on the data form. |
MaxRegions | Number | Read-only | Specifies whether the field is visible on the data form -1, any number of regions is allowed. |
Name | String | Read-only | Service name of the field. |
NamePath | String[] | Read-only | Array of field and group names that form the path to the field. |
NeedRecognize | Boolean | Read/write | Specifies whether to retrieve the field value from the region when the rules are checked again. |
Regions | { Id: number; Status: number; PageId: Number; IsNew : Boolean; Coordinates: Object [{X1,X2,Y1,Y2}]; }[] |
Read-only |
Array of regions.
|
Text entry field
Name | Type | Rights | Description |
---|---|---|---|
Flags | Number[] | Read/write |
array of the same length as the field Value. Consists of 0 and 1. 0 – a character that is in Value in the same position as 0 in Flags, requires verification. |
Suggests | String[] | Read-only | List of suggested field values |
Value | String | Read/write | Field value |
TextType | Number | Read-only |
Type of text field. Possible value:
|
Caption | String | Read-only | Custom field name, caption |
FieldType | Number | Read-only |
Field type. Possible value: 0 – text field |
Id | Number | Read-only | Field ID |
IsReadOnly | Boolean | Read-only | Specifies whether field editing is disallowed. |
IsVisible | Boolean | Read-only | Specifies whether the field is visible on the data form. |
MaxRegions | Number | Read-only | Maximum number of field regions. If the value is -1, any number of regions is allowed. |
Name | String | Read-only | Service name of the field. |
NamePath | String[] | Read-only | Array of field and group names that form the path to the field. |
NeedRecognize | Boolean | Read/write | Specifies whether to retrieve the field value from the region when the rules are checked again. |
Regions | { Id: number; Status: number; PageId: Number; IsNew : Boolean; Coordinates: Object [{X1,X2,Y1,Y2}]; }[] |
Read-only |
Array of regions.
|
IsVerified | Boolean | Read/write | Specifies whether the field has been verified. |
NeedVerification | Boolean | Read-only | Specifies whether the field requires verification. |
NeedDoubleVerification | Boolean | Read-only | Specifies whether the field requires double verification |
IsSummary | Boolean | Read-only | Specifies whether the field is used in the formation of data summary on the data form. |
Checkmark field
Name | Type | Rights | Description |
---|---|---|---|
Value | Boolean | Read/write | Field value |
Caption | String | Read-only | Custom field name, caption |
FieldType | Number | Read-only |
Field type. Possible value: 2 – checkmark |
Id | Number | Read-only | Field ID |
IsReadOnly | Boolean | Read-only | Specifies whether field editing is disallowed. |
IsVisible | Boolean | Read-only | Specifies whether the field is visible on the data form. |
MaxRegions | Number | Read-only | Maximum number of field regions. If the value is -1, any number of regions is allowed. |
Name | String | Read-only | Service name of the field. |
NamePath | String[] | Read-only | Array of field and group names that form the path to the field. |
NeedRecognize | Boolean | Read/write | Specifies whether to retrieve the field value from the region when the rules are checked again. |
Regions | { Id: number; Status: number; PageId: Number; IsNew : Boolean; Coordinates: Object [{X1,X2,Y1,Y2}]; }[] |
Read-only |
Array of regions.
|
IsVerified | Boolean | Read/write | Specifies whether the field has been verified. |
NeedVerification | Boolean | Read-only | Specifies whether the field requires verification. |
NeedDoubleVerification | Boolean | Read-only | Specifies whether the field requires double verification. |
IsSummary | Boolean | Read-only | Specifies whether the field is used in the formation of data summary on the data form. |
Checkmark Group field
Name | Type | Rights | Description |
---|---|---|---|
MaxSelectedCount | Number | Read-only | Maximum number of selected field values. |
MinSelectedCount | Number | Read-only | Minimum number of selected field values. |
Values | Number[] | Read/write | Field value. An array of record IDs that make up the list of possible field values (Variants). |
Variants | {Id:number, Name:string}[] | Read-only |
List of possible field values:
|
Caption | String | Read-only | Custom field name, caption |
FieldType | Number | Read-only |
Field type. Possible value: 3 – checkmark group |
Id | Number | Read-only | Field ID. |
IsReadOnly | Boolean | Read-only | Specifies whether field editing is disallowed. |
IsVisible | Boolean | Read-only | Specifies whether the field is visible on the data form. |
MaxRegions | Number | Read-only | Maximum number of field regions. If the value is -1, any number of regions is allowed. |
Name | String | Read-only | Service name of the field. |
NamePath | String[] | Read-only | Array of field and group names that form the path to the field. |
NeedRecognize | Boolean | Read/write | Specifies whether to retrieve the field value from the region when the rules are checked again. |
Regions | { Id: number; Status: number; PageId: Number; IsNew : Boolean; Coordinates: Object [{X1,X2,Y1,Y2}]; }[] |
Read-only |
Array of regions.
|
IsVerified | Boolean | Read/write | Specifies whether the field has been verified. |
NeedVerification | Boolean | Read-only | Specifies whether the field requires verification. |
NeedDoubleVerification | Boolean | Read-only | Specifies whether the field requires double verification. |
IsSummary | Boolean | Read-only | Specifies whether the field is used in the formation of data summary on the data form. |
Picture field
Name | Type | Rights | Description |
---|---|---|---|
Caption | String | Read-only | Custom field name, caption |
FieldType | Number | Read-only |
Field type. Possible value: 1 – picture |
Id | Number | Read-only | Field ID. |
IsReadOnly | Boolean | Read-only | Specifies whether field editing is disallowed. |
IsVisible | Boolean | Read-only | Specifies whether the field is visible on the data form. |
MaxRegions | Number | Read-only | Maximum number of field regions. If the value is -1, any number of regions is allowed. |
Name | String | Read-only | Service name of the field. |
NamePath | String[] | Read-only | Array of field and group names that form the path to the field. |
Regions | { Id: number; Status: number; PageId: Number; IsNew : Boolean; Coordinates: Object [{X1,X2,Y1,Y2}]; }[] |
Read-only |
Array of regions.
|
Repeating Group of Sections field
Name | Type | Rights | Description |
Id | Number | Read-only | Field ID |
Name | String | Read-only | Field name |
Sections | Section[] | Read-only | Array of fields of Section type |
FieldType | Number | Read-only |
Field type. Possible value: 8 – recurring section group. |
Properties of the document object
Name | Type | Rights | Description |
---|---|---|---|
AssemblingErrors | { DocumentNodeRef: number[][]; Description: string; SectionName: string[] }[] |
Read-only |
Build errors in the document where:
|
BatchId | Number | Read-only | The package ID |
Errors | { DocumentNodeRef: number[][]; Severity: number; Message: string; RuleName: string; }[] |
Read-only |
Errors in the document where:
|
Fields | (Section | SectionsGroup)[] | Read-only | List of sections/duplicate sections |
Id | Number | Read-only | Document identifier |
Index | Number | Read-only | Index of the document in the package |
Pages | { Id: number; Modification: number; HasColorImage: boolean; ImageResolution: number; KeyValue: string; SectionTemplateId: number; SectionTemplateName: string; FlexibleInstanceId: number; SectionTemplatePageNumber: number; Comment: string; ImageWidth: number; ImageHeight: number; }[] |
Read-only |
List of document pages containing the following:
|
ProjectId | Number | Read-only | Project identifier |
TaskId | Number | Read-only | Task ID |
TemplateId | Number | Read-only | Definition ID of the document |
TemplateName | String | Read-only | The name of the definitions document |
TemplateVersion | Number | Read-only | Definition version of the document |
Version | Number | Read-only | Document version |
12.04.2024 18:16:02