




Applies to version 2019.1; author: Kamil Nędza
1. Introduction
When working everyday in WEBCON BPS environment it’s a good idea to spend a while on configuring a group of universal constants and global rules. Time spent on creating them will be a good investment as more processes will be created in the future. This article presents a couple of real-life usage examples of:
- Global constants
- Global business rules
- Global form rules
2. Global constants
Below are some ideas for universal usage of global constants.
2.1. Mail prefix
If you send e-mail notifications to users it’s worth to add a global constant to the e-mail subject. This global constant will inform users that the received e-mail does not come from the production environment. To do that you can use a global constant which should be added to the e-mail subject. For example, the constant will return „[TEST MAIL]” for DEV and TEST environments. For PROD environment the constant will not return anything. Constant can be used in global e-mail template and in the action of sending a configurable e-mail.

E-mail subject configuration example can look as following:

2.2. Type of environment
It is a good idea to create a global constant which will return the type of the current installation. It can be used to manage workflows and to configure action execution. You don’t want to send an e-mail to the management from the testing environment at UAT tests? Do you want to add privileges to an additional tester group during tests? Now it’s simple – just add a proper condition on action execution.

2.3. SharePoint group ID
For SharePoint groups which are used in multiple processes (for example IT administrators group, tester group) it is a good idea to store the ID of this group as a global constant. In the next paragraphs you will be presented with how this kind of constant can be used.

2.4. Website address
Another global constant which is worth preparing is a basic website address. It can be used to create URL addresses for links, action configuration or be used in preinstalled SQL functions (for example dbo.isUserInSPGroup).

2.5. Simple JavaScript functions – service work
Within process constant you can define also a JavaScript function which then will be executed on the workflow. Here is an example of JavaScript function which after opening the form will display user a prompt about undergoing service and then redirect him to the main website.

The constant needs to be placed in the section of rules executed on page load.

On the screenshot below you can see the form in action. After clicking OK the user will be redirected to WEBCON BPS main page.

3. Business rules
Here you can see a couple of examples of business rules which will enhance your everyday work. Just remember that in case of returning boolean data type, you don’t have to explicitly return true or false. The condition itself will do. Two business rules seen below are equal:

3.1. IsProd
Here’s another simple example of a rule which returns information whether current environment is a production one. For example the rule can be used during configuration of action execution conditions (integration with external systems, sending configurable e-mails, etc.). This rule uses a global constant which was previously introduced in this article.

3.2. Calculating currency exchange rate to PLN
If you need to frequently calculate currency exchange rate in a number of processes it’s worth to prepare a dedicated global business rule. On screenshots below you can see an example of this type of action configuration. Remember, for the rule to work flawlessly, you need to turn on and start currency exchange rate synchronization in the system settings.

On the right side of the screenshot above is a tab with parameters. Rule will use three parameters in the SQL query. Parameters allow to invoke the configured rule in many places with different data which makes it reusable.

Below you can see an example of invoking a rule and its result. In real-life usage, as parameters provide variables returning values from the workflow form.

3.3. Existence of an attachment on the form
One of the most common actions in the workflow is one which verifies existence of an attachment on the workflow element. It comes at no surprise that its important to optimize configuration process of this action. Below you can see business rule configuration which verifies if there is an attachment on the current workflow element. This rule is very universal, however the author encourages to experiment and broaden business rules with new functions like indicating a specific file extension (ATT_FileType column).


3.4. Downloading all SharePoint group users
Sometimes it is needed to download all users from a specific SharePoint group. This is another case in which you can use a business rule. Below is an example of business rule configuration which returns list of all SharePoint group users.



3.5. Using working days calendar
After configuring working days calendar (which is described in detail here: http://howto.webcon.com/working-days-calendar-in-webcon-bps/) it’s a good idea to prepare rules which will return information you need. For example those can be rules returning information if a specific date is a working day or how many working days are between the provided date range.
Let’s start with a rule returning information about working day:



In workflows which need the number of working days (for example absence request process) it’s vital to have a rule prepared just for that. Here is an example of a rule which returns number of working days in the specified date range. If the date of the beginning and the end is the same, the rule will return 1 or 0, depending if this day is a working one or not.


Here are two examples of testing results of the business rule. In Poland the New year’s day is a day off so in the presented time frame there is only one working day – 2nd of January 2019.

Of course there is nothing wrong with using other business rules as parameters of the global rule. Here is an example of testing the rule which returns number of working days in the next month from today. Test happened on the 2nd of April and the 22nd of April and the 1st of May are days off.

Author suggests that you can create more rules connected with the working days calendar. You can also use rule which returns the closest working day after X working days from a selected date.
4. Form rules
WEBCON BPS can define global form rules. Simple examples which can help with creating processes on a day-to-day basis are presented below.
4.1. Conditional verification of comment entering
Comment verification can be forced by a single checkbox placed in the path configuration. But what if it’s needed to connect the necessity of entering the comment with the value on the form? To do that you can create a global form rule which will return information whether the comment was filled in.
Caution: Described functionality is supported only on classic form.

Such a rule can be used for example on a transition path. Invoking example can be seen below.
In this specific case if the request is denied and the comment is not written, a prompt will be displayed and the form will remain in the same step. In other case the instance will go through the path to the next step.


4.2. Distinguishing the form field
Within form rules it’s possible to define form field formatting which will be visible in all processes. This standardized method helps to draw user’s attention to key data on the form. Below is an example of universal form rules which will use a proper style for the passed form field parameter.


Two form rules are defined above, both for positive and negative response. Change of form field’s background color tells us which response was given.
Below is an example of such a form rule. If the request was accepted, form field background will be green, if denied – red.




5. Summary
Global constants and global rules are tools of great magnitude for everyday work with WEBCON BPS. Examples mentioned above are only the tip of an iceberg. We would like to know what are your ideas for everyday work optimization in WEBCON Designer Studio. Share them in the comments!