> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://docs.flokzu.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Flokzu Services Integration

In Flokzu you can integrate your process with different applications either through Zapier or by calling external Web Services.
But you can also call Flokzu's Public API to interact with your Databases or with other existing instances.


# How to call a Flokzu service?

The first thing you should do is place a Service Task at any stage of your workflow where you want to make the service call and select the **Flokzu Services** option.


![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/cajitasen_1y9sevp.gif)

## Database Integration

In Database integration we have three available uses:

* Add a new record to a database
* Edit an existing record
* Get data from an existing record



![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_1m3s656.png)


### Add record

This action will add a new record into the selected Database, filling each column with the content of your form's fields, or a default value.

To call this service you must set up as follows: 

* Add an optional title to identify the action easily ( 1 )
* Select the database you want to add record to (2)
* At Input tab you must set up the columns to fill and the form fields from where the source data will be obtained (3). Also, by clicking on the pencil icon, you can set a default value to load into every instance.
* This service returns the ID of the new record as output, which can be optionally saved into your form, using the Output tab (4)


![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_1pzio5o.png)


### Edit record

With this action you will be able to select the database and edit it's records by setting values from your form, or default values for every process instance.

To configure this integration you must complete the following:

* Add an optional title to identify the action easily (1)
* Select the Database where the record you want to edit is stored (2)
* In the Input tab, you must first set the record ID and then set the target columns and the form fields from where the source data will be obtained (3). By clicking on the pencil icon, you are able to set a default value to load
* This service returns *true* or *false* as output. *True* if the record was successfully updated, or *false* otherwise. Optionally you can save this value in a form field (4)

||| Keep in mind that when editing a Database record, the existing values ​​will be overwritten.
| If the selected ID does not exist, you will be able to add the data as a new record, by selecting the *Insert record if it does not exist* box.


![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_6rppk9.png)


### Get record

With the *Get Record* action you will be able to search within a Database and save the values into the form fields.

* Add an optional title to identify the action easily (1)
* Select the Database where the record you want to edit is stored (2)
* In the Filter tab, you must select the column to be filtered and the value to search. The value can come from a form field or it can be set as a default value (3)
* The service will return the values ​​of the columns of the record that matches the filter, and you can save it in your form by setting the target fields in Output tab (4)

| If the filter matches with more than one record, only the first record will be returned. To avoid unwanted behaviors,  we recommend filtering by a unique value column (For example: ID)


![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_1ly7g6c.png)

## Integration with Process Instances

Flokzu also allows you to perform actions on your process instances. With this integration you will have three operations available:

* Create a new process instance
* Edit an existing instance
* Get an existing instance data


||| Note that you will only be able to interact with *active* fields and processes. Make sure you have published the latest version of your process before configuring the integration.


![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_8z3iw9.png)


### New process instance

You will be able to automatically create a new instance just with a simple service call. To do so, follow these steps:

* Add an optional title to identify the action easily (1)
* Select the process you want to create (2)
* In *Input* tab you will be able to choose the fields that will be loaded. The value can come from a form field or it can be set as a default value for every process instance (3)
* The service will return the identifier of the created instance and it's initiation date. You can optionally save it in your form setting the target field in Output tab (4)


||| We do not recommend placing this service call immediately after the Start Event unless you are sure that it does not cause loops. For more information, refer to the "Avoid these issues" section.


![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_3rr4yu.png)

### Edit instance

This action allows you to automatically update a process instance by calling the action in the workflow.

| Remember that you can only modify ACTIVE instances, that is, those that have not yet finished.
|| With this action you will not be able to modify the same instance that is running. In that case you should use the ECHO service from the Flokzu Public API. Refer to the following examples for how to add a [creation date](/en/article/add-creation-date-automatically-to-your-form-t41z4a/), [completion date](/en/article/add-completion-date-automatically-to-your-form-1j0j4zf/) or [labels](/en/article/can-i-assign-tags-labels-automatically-1i01qwy/) automatically.

* Add an optional title to identify the action easily (1)
* Select the process of the instance you want to edit (2)
* In Input tab you must first set the Instance identifier you want to modify. The following parameters will be the target fields and the source value (from a field or it can also be a default value) (3).
* This service returns *true* as output if the instance was successfully updated,  or *false* otherwise. Optionally you can save this data in a form field (4)

||| Keep in mind that this action overwrites the fields of the selected instance.



![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_yb31es.png)


### Get instance

*Get Instance* allows you to access data from a certain instance and save it in your form, without modifying any of the source data. Set up the service call as follows:

* Add an optional title to identify the action easily (1)
* Select the process of the instance you want to get (2)
* In Filter tab you must set the Identifier of the instance you want to get, referenced in a form field or by clicking on the pencil icon, you can set a fixed default identifier (3)
* In the Output tab you will be able to choose which field of the instance (Output) will be saved in your form (Target Field) (4)



![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_r8vrrv.png)


## Create PDF

**Create PDF** is a new **Service Task** type available within Flokzu Services. It allows you to automatically generate a PDF file from the process instance printout during the execution of the process flow.

This functionality allows document generation to be incorporated as an automatic step within the process, without manual user intervention.


![](https://storage.crisp.chat/users/helpdesk/website/-/c/c/c/3/ccc3fbb5dc442800/image_12cy18p.png)


### Create PDF Configuration

When adding a **Create PDF** Service Task to the process, you can configure:

* The templates that will be included in the PDF: the default template and/or custom templates. Multiple templates can be selected.
* The printing order of the templates.
* Whether to include document attachments in the final PDF.
* The name of the generated PDF file.
* The location where the file will be stored: in an attachment-type field or in the document attachments tab.


| When multiple templates are selected, Flokzu generates a single PDF by concatenating the documents in the configured order.




![](https://storage.crisp.chat/users/helpdesk/website/-/c/c/c/3/ccc3fbb5dc442800/image_1jpz1o2.png =491xauto)




### Execution result

When the instance reaches the **Create PDF** Service Task, Flokzu automatically generates the PDF file according to the defined configuration and stores it in the selected location.

The generated file remains associated with the instance's electronic document and can be used in subsequent process steps.

|| The generated PDF will include the fields configured for printing. The process administrator is responsible for verifying that the appropriate read permissions are configured for the information included in the document.

|| If the selected attachment-type field already contains a file, the existing content will be overwritten and an alert will be displayed.

### Generation errors

Errors during PDF generation, such as format incompatibilities or size issues, are recorded in the error monitor.



## How to integrate with another tenant in Flokzu?

To interact with databases or instances from another tenant in Flokzu, you must call the services from the [Public API](/en/article/does-flokzu-have-a-public-api-11nycit/) by setting it up with the data provided by an Administrator.

## Avoid these issues

### Loop when creating an instance of the same process

**When it happens?**
It happens if the first task in the workflow is a Service Task that creates a new instance of the same process.



![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_olowb6.png)

**Description**
In this case, each instance created could call the service creating a new instance that starts the cycle again, generating a loop.
This behavior is detected by Flokzu, which will show you an error message and will not allow the execution to continue

### Loop between two different processes

**When it happens?**
If your organization has two processes *A* and *B* whose first workflow's task creates an instance of the other process.


![](https://storage.crisp.chat/users/helpdesk/website/ccc3fbb5dc442800/imagen_yeqkgd.png)

**Description**
In this case, the created instance of process *A* will create an instance of process *B* which will create another instance of *A*, generating a loop.
This behavior is also detected by Flokzu, you will recieve an error message and will not be able to continue the execution.

### Update process instance through integration with Flokzu services

Recently launched integration with Flokzu services allowing expedite the process of upgrading an instance can review the documentation here.

[Flokzu Services Integration](/en/article/flokzu-services-integration-379otq/)