Batch creation of entities in data factory v2
🌐 This document is available in both English and Ukrainian. Use the language toggle in the top right corner to switch between versions. |
Name | Description |
---|---|
Business name |
Batch creation of entities in data factory v2 |
Service name |
|
Filename in the extensions library |
dataFactoryConnectorBatchCreateDelegateV2.json |
1. General description
The general integration delegate extension allows to interact with the registry’s REST API and create entities in the database as the LIST
or CSV
arrays transactionally, i.e. either all data or none are stored. A delegate is configured in Service Tasks of a business process using the Batch creation of entities in data factory v2 template.
The maximum number of records to upload into the database using this delegate is 50:
|
For more information about using the delegate in business processes, see Uploading data from a CSV file as an array into a database. |
2. Configuring template in a business process
When configuring a delegate in the Camunda Modeler application, make sure that the resources > element-templates folder with the application contains the dataFactoryConnectorBatchCreateDelegateV2.json file. |
-
Open Service Task, press Open Catalog and select the template from the list, then press Apply.
-
In the
Name
field, enter the task name. -
In the
Resource
field, enter the resource, the name of the endpoint for the table where the data will be stored. For example,diplomas
. -
In the
Upload type
field, select the data download format from the list:CSV
, orLIST
.For both types,
CSV
andLIST
, the connector configuration is the same. Only${payload}
is different, which is usually formed during the previous script task of the process and passed to the service task as the${payload}
variable.-
If you want to load data as an array in the CSV format, then
payload
can be generated in the script as follows:
set_transient_variable('payload', submission('signCsvFileActivity').formData.prop('csvFile').elements().first())
That means that we get a list of the
csvFile
elements from the form (formData
) using thesubmission()
JUEL function; we form thepayload
object and then use it as a variable when configuring the delegate. You can upload the CSV data to the form using theContent
component (follow this link to learn more about forms modeling).-
If you want to upload the data as an array in the
LIST
format, thenpayload
can be generated in the script as follows:
var data= ''' [ { "data":"test data", "description":"some description" }, { "data2":"test data2", "description2":"some description2" } ] ''' execution.setVariable("jsonArray", S(data))
We create the
data
string that contains a JSON array with two objects. Each object contains the key-value pairs — data that is taken from the UI form. We write the result to thejsonArray
variable, which we then use when configuring the delegate. You can upload the data as an array to the form using theEdit Grid
component (follow this link to learn more about forms modeling). -
-
In the
Payload
field, enter the data to be created; this data is passed in the body of the request. For example,${payload}
. -
In the
X-Access-Token source
field, enter the user access token to the system used for the current operation. For example,${completer('signCsvFileActivity').accessToken}
. -
In the
X-Digital-Signature source
field, enter the source of the digital signature. For example,${sign_submission('signCsvFileActivity').signatureDocumentId}
. -
In the
Result variable
field, enter any name for the output parameter (default name isresponse
).