Articles on: Tutorials
This article is also available in:

Representing a user hierarchy using Web Services

Flokzu Databases can be used in many ways: to store valuable information shared by multiple processes (table of products, vendors, etc.), to create your own CRM, to avoid entering repeated information manually (such as list of countries, cities, districts, etc.), and more.

Databases can even be used to represent organizational hierarchy and automate things like assigning a task or sending an email to your boss. These use cases are the focus of this post.

This example will use a database called ‘Hierarchy’ with the following schema:



The idea behind it is to use the database to save the relationship between employees and supervisors.


Example 1: Sending an email to the supervisor

For this example, it’s not necessary that either of the email addresses are valid users within Flokzu.
First of all, include an Email field type in the process form. In this example we’ll call it ‘Recipient’. If you want, it can be hidden in every task of the workflow. We’ll use it to store the supervisor’s email and set it as the recipient of the Send Task.
At a certain step in your workflow where you want to send the email, you have to include the following sequence:


The Service Task will be used to invoke a REST Web Service and obtain the email of the supervisor, which will be stored in the Email field.

Setting up the Service Task
The Service Task should be set up as follows:


URL: https://app.flokzu.com/flokzuopenapi/api/ApiKey/database/dbase

ApiKey should be replaced with the Api Key generated for your organization.
database should be replaced with the exact same name of the database, including uppercase, lowercase and special characters. In our case it’s Hierarchy.

Method: GET

Input: Parameter names should always be paramName and paramValue.

The value of paramName should be the name of your database column where the employee’s email is stored (in our case it’s userEmail).
The value of paramValue is the email that you want to use. It can be the Previous Task Participant, the Process Initiator (only works if it’s not via Public Form) or even an email stored in one of your fields.

Output should be set up as follows:


Parameter name is the name of the column you want to use in your database (in our case bossEmail) and Field is the Email field.

Request Headers should be left blank.
Once you set this up, in the Recipient field will be stored the email of the supervisor. Just use that email as the recipient of the Send Task and you’ll be good to go.


Example 2: Assigning a task to the supervisor

In this case, the supervisor should be a valid user within Flokzu.

Include the task that the supervisor should complete in your workflow and as assignee select the special user [Web Service]. This means that the task assignation will be done dynamically via REST Web Service.

Click the link that reads ‘Set up your Web Service here…‘ and use the configuration described before. The only difference is that in this case the Output should be set up like this:

Updated on: 15/01/2019

Was this article helpful?

Share your feedback

Cancel

Thank you!