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.
Table 1. Delegate summary
Name Description

Business name

Batch creation of entities in data factory v2

Service name

${dataFactoryConnectorBatchCreateDelegateV2}

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:

  • 50 records for LIST

  • 50 records for CSV.

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.
  1. Open Service Task, press Open Catalog and select the template from the list, then press Apply.

    loading data from csv 05

  2. In the Name field, enter the task name.

  3. In the Resource field, enter the resource, the name of the endpoint for the table where the data will be stored. For example, diplomas.

  4. In the Upload type field, select the data download format from the list: CSV, or LIST.

    For both types, CSV and LIST, 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 the submission() JUEL function; we form the payload object and then use it as a variable when configuring the delegate. You can upload the CSV data to the form using the Content component (follow this link to learn more about forms modeling).

    • If you want to upload the data as an array in the LIST format, then payload 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 the jsonArray variable, which we then use when configuring the delegate. You can upload the data as an array to the form using the Edit Grid component (follow this link to learn more about forms modeling).

  5. In the Payload field, enter the data to be created; this data is passed in the body of the request. For example, ${payload}.

  6. 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}.

  7. In the X-Digital-Signature source field, enter the source of the digital signature. For example, ${sign_submission('signCsvFileActivity').signatureDocumentId}.

  8. In the Result variable field, enter any name for the output parameter (default name is response).

    loading data from csv 04