VariableServiceallows you to manage non-logical variables of the form. It has the following functions: - get- gets the form variable component.
Name | Type | Default value | Description |
---|
id | String | null | Form variable identifier (process variable identifier) |
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).
Name | Type | Default value | Description |
---|
id | String | null | Form variable identifier (process variable identifier) |
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.
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) |
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 |
- 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 |
- 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 |
- setStyle - sets the HTML style of the variable
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"} |
- hide- hides form variables (including dynamic tables).
Name | Type | Default value | Description |
---|
variables | String/String[] | null | Identifier or array of form variable identifiers (process variable identifiers) |
- show- shows form variables (including dynamic tables).
Name | Type | Default value | Description |
---|
variables | String/String[] | null | Identifier or array of form variable identifiers (process variable identifiers) |
- disable- blocks the ability to enter values into the field.
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 |
- enable- unblocks the ability to enter values into the field.
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. |
- showLoadingIndicator - masks the field displaying information that an event is being carried out on it, it is also possible to provide additional text information.
Name | Type | Default value | Description |
---|
id | String | null | Form variable identifier (process variable identifier) | message | String | 'Loading...' | Additional text information |
- hideLoadingIndicator- removes the mask from the field informing about the event execution on this field.
Name | Type | Default value | Description |
---|
id | String | null | Form variable identifier (process variable identifier) |
- markError - adds error information below the field.
Name | Type | Default value | Description |
---|
id | String | null | Form variable identifier (process variable identifier) | errors | String/String[] | null | The content of the error/errors |
- unmarkError - removes information about errors from the field.
Name | Type | Default value | Description |
---|
id | String | null | Form variable identifier (process variable identifier) |
- 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 |
- 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.
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 |
- 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: - override (Type: Boolean) - tells whether to overwrite the existing AUTO_UPDATE action definition if the field already has it, the default value is false - destinations(Type: table of objects) – consecutive variables, which value is set after the server action, objects in the table have fields: id - variable identifier on the form, errorMessage - text displayed at the form variable, when its value can not be set, default value: empty table) - errorMessage(Type: String) - the text of the global error message when executing the action, the default value is: null - eventType(Type: String) - type of event that will trigger an action for a given variable on the form, it is possible to use three types of events: blur (exit from the field), change (change value in the field), select (select a value from the drop-down list), default value: ' blur ' - loadingText(Type: String) information content displayed on the variable of the form to which the action is applied and on all variables defined in destinations, default value: 'Loading ...' - 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 |
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.
Name | Type | Default value | Description |
---|
id | String | null | Form variable identifier (process variable identifier) |
- 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 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 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 |
Type | Description |
---|
boolean | True, if the automatic mapping is suspended for the given variable. Else false. |
|