VariableServiceallows you to manage non-logical variables of the form. It has the following functions:
- get- gets the form variable component.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
- Function result:
Type | Description |
---|---|
Ext.Component | Process variable component or undefined if it is not found |
- getName- returns the name of the form variable including translation (shown in the label).
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
- Function results:
Type | Description |
---|---|
String | Name of the form variable or null if the form variable is not found |
- getValue- returns the value of the form variable.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
asString | Boolean | false | Indicates whether the value should be returned in the form of a string (it is important for dates, numbers and radiobutton and checkbox fields) |
- Function results:
Type | Description |
---|---|
Object/String | The value of the form variable or null if the form variable is not found. The type of response depends on the value of the asString parameter |
- Function parameters:
- setValue- sets the value of the form variable (does not change the values of variables that are only for preview).
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
value | Object | null | Value of the form variable |
- Function results:null
- setDescription- sets the description of the form variable.
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
description | String | null | Description of the form variable |
- Function results:null
- setStyle - sets the HTML style of the variable
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
labelStyle | Object | null | An object containing HTML styles that will be applied to the variable label, e.g. {color: "red", "font-size": "16px"} |
fieldStyle | Object | null | An object containing HTML styles that will be applied to a variable field, e.g. {color: "red", "font-size": "16px"} |
- Function results:null
- hide- hides form variables (including dynamic tables).
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variables | String/String[] | null | Identifier or array of form variable identifiers (process variable identifiers) |
- Function results:null
- show- shows form variables (including dynamic tables).
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
variables | String/String[] | null | Identifier or array of form variable identifiers (process variable identifiers) |
- Function results:null
- disable- blocks the ability to enter values into the field.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
silent | Boolean | false | Indicates whether to trigger an event to block the field |
enableSubmit | Boolean | false | It tells you whether despite variable is blocked to send its value to the server when you accept/save the form |
- Function results:null
- enable- unblocks the ability to enter values into the field.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
silent | Boolean | false | Indicates whether to trigger an event to unblock a field. |
- Function results:null
- showLoadingIndicator - masks the field displaying information that an event is being carried out on it, it is also possible to provide additional text information.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
message | String | 'Loading...' | Additional text information |
- Function results:null
- hideLoadingIndicator- removes the mask from the field informing about the event execution on this field.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
- Function results:null
- markError - adds error information below the field.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
errors | String/String[] | null | The content of the error/errors |
- Function results:null
- unmarkError - removes information about errors from the field.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
- Function parameters:
- Function results:null
- addEvent - adds an event (action) to the field on the form.
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
eventName | String | null | Event name (see Ext JS documentation) |
handler | Function | null | Function that handles the event |
scope | Object | Ext.Component representing the field on the form for which the event occurred | Scope in the function specified in the handler parameter |
- Function results:null
- removeEvent - removes the event (action) from the field on the form. You must pass the same parameters to the function as for the addEvent function in order to correctly delete the event (action) from the form field.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
eventName | String | null | Event name (see Ext JS documentation) |
handler | Function | null | Function that handles the event |
scope | Object | Ext.Component representing the field on the form for which the event occurred | Scope in the function specified in the handler parameter |
- Function parameters:
- Function results:null
- addAutoUpdate - adds the AUTO_UPDATEaction definition to the field on the form. It requires preparation of a servlet, which is based on the same action as when performing the AUTO_UPDATE action specified in the process map.
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
config | Object | { } | AUTO_UPDATEaction definition object. It has the following fields: - dataSources(Type: string array) - variables whose values are passed to the server, default value: empty table - taskName(Type: String) - name of the servlet being executed, default value: null |
- Function results:null
Call function example
ServiceFactory.getVariableService().addAutoUpdate( 'net_value', {
dataSources: [ 'net_value', 'vat_value', '\'ADD\'' ],
destinations: [ {
id: 'gross_value',
errorMessage: ‘Error setting gross value'
} ],
taskName: 'com.plusmpm.servlet.extension.CUF.AmountCalculator.customServlet',
errorMessage: 'An error occurred.',
eventType: 'blur',
loadingText: 'Calculating...'
} );
- removeAutoUpdate - deletes the AUTO_UPDATEaction definition from the field on the form.
- Function parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Form variable identifier (process variable identifier) |
- Function parameters:
- Function results:null
- suspendAutoMapping -suspends automatic pulling of auto mappings for DC
Name | Type | Default value | Description |
---|---|---|---|
ids | String/String[] | null | Identifier or table of variable identifiers for which automatic mapping will be suspended |
- Function parameters:
- Function results:null
- resumeAutoMapping - resumes automatic pulling of auto mappings for DC
Name | Type | Default value | Description |
---|---|---|---|
ids | String/String[] | null | Identifier or table of variable identifiers for which automatic mapping will be resumed |
- Function parameters:
- Function results:null
- isAutoMappingSuspended - checks whether automatic mapping is suspended for the given variable
Name | Type | Default value | Description |
---|---|---|---|
id | String | null | Identifier of the variable |
- Function results:
Type | Description |
---|---|
boolean | True, if the automatic mapping is suspended for the given variable. Else false. |