Applies to version 2019.1; author: Konrad Wojtycza
The article describes the use of “Change value single field” and “Change values of multiple fields” actions on the example of the business scenario of the settlement of business trips.
These actions allow you to update the value of the single form field or many form fields at the same time based on:
The action of changing value can be defined on a path, after clicking a button or on timeout.
The “Change value single field” action has been used to determine the exchange rate at which business trip expenses will be calculated. The final rate consists of two values – the average rate and foreign currency unit.
Fig. 1. The configuration of the “Change value of single field” action
Field – all form fields related to the form used in the process, and also system fields such as [System] Comment and [System] Parent workflow instance ID.
Comment author – selecting “[System] Comment” enables you to select the comment author and set the comment value. Selecting the “[System] Parent workflow instance ID” option allows you to set the WFD_WFDID value – the parent of the current instance and relate it with the current instance.
Value – this field defines the value set after execution of the action. In this field you can use all functions and form fields available for business rules e.g. arithmetic operations, SQL expressions and form fields available on the form.
Error message – this field defines the error message displayed when there is a missing value error. It is recommended to set a custom error message with a form field that has not received a value.
If there are no results – this field defines the behavior of the value change action when a value missing error occurs. When, for business reasons, the value may be unavailable and it should not be considered an error, you can skip it – select the “Allow no value” option.
Fig. 2. Disabling the error message
The “Change values of multiple fields” action is used to when more than one value is from the same source.
Fig. 3. The configuration of the “Change values of multiple fields” action
Data source – it is used to indicate the source or data source connection from which values indicated by action will be downloaded. The data source can be defined as any data source available to the current WEBCON BPS system. Remember that in SQL source you must use a SQL query and in the case of other sources – a properly prepared filter. If you define data source but do not set SQL query or filter, the system will return all columns available in the data source.
SQL query/filter – in this field a SQL query or filter is defined
Fields mapping – based on the SQL query/filter, this section automatically recognizes the values that can be assigned to fields from the form. Click the “Get columns” button – the available columns will be displayed in the “Fields mapping” section. To map, assign (in the same row) a column selected from the data source to the appropriate field available on the form.
For this action there it is not possible to set a dedicated error message – the default message is “Value not received” and can be caused e.g. changing the columns defined in the configuration of the action.
The default error message does not indicate value that was unavailable. To avoid this, add validation before executing the action that checks the availability of each value downloaded by the query.
Fig. 4. The validation checking the available values
The process of delegation settlement
The example Delegation settlement workflow has been created to present these actions.
Fig. 5. The Delegation settlement workflow
In the presented process, expenses registered in a foreign currency are converted into a value in PLN using the exchange rate taken from the table of exchange rates synchronized with the National Bank of Poland based on the receipts presented by employees.
Actions are defined on the “Convert” transition path and will be triggered after selecting this path by a user.
Fig. 6. Actions defined on the “Convert” transition path
The “Change values of multiple fields” action set two fields:
The exchange rate value is downloaded based on the “The day before delegation settlement” field from the exchange rate table. The “Average exchange rate” field is filled in using the “Change value of single field” action (Fig. 1). The value of this field is determined as the quotient of the “Average rate” and “Foreign currency units” fields, previously set by the “Change values of multiple fields” action.
Finally, the amount in a foreign currency is converted into an amount expressed in PLN.
Fig. 7. The Delegation settlement form
Actions described in this article are one of the most frequently used actions in WEBCON BPS. It is worth knowing the difference between the configuration of the action of changing the value of a single field and the configuration of changing the value of multiple fields in order to use them effectively depending on the requirements of the process.