See the supported connectors for Application Integration.

Concat a string to a string array

Using the Data Mapping task, iterate through the elements of a string array and apply transformation functions to concat a string value to all the array elements.

Code sample

{
  "triggerConfigs": [{
    "label": "API Trigger",
    "startTasks": [{
      "taskId": "1"
    }],
    "properties": {
      "Trigger name": "tkApplicationIntegrationSample2_API_1"
    },
    "triggerType": "API",
    "triggerNumber": "1",
    "triggerId": "api_trigger/tkApplicationIntegrationSample2_API_1"
  }],
  "taskConfigs": [{
    "task": "FieldMappingTask",
    "taskId": "1",
    "parameters": {
      "FieldMappingConfigTaskParameterKey": {
        "key": "FieldMappingConfigTaskParameterKey",
        "value": {
          "jsonValue": "{\n  \"@type\": \"type.googleapis.com/enterprise.crm.eventbus.proto.FieldMappingConfig\",\n  \"mappedFields\": [{\n    \"inputField\": {\n      \"fieldType\": \"STRING_ARRAY\",\n      \"transformExpression\": {\n        \"initialValue\": {\n          \"referenceValue\": \"$stringArray$\"\n        },\n        \"transformationFunctions\": [{\n          \"functionType\": {\n            \"stringArrayFunction\": {\n              \"functionName\": \"FOR_EACH\"\n            }\n          },\n          \"parameters\": [{\n            \"initialValue\": {\n              \"literalValue\": {\n                \"protoValue\": {\n                  \"@type\": \"type.googleapis.com/enterprise.crm.eventbus.proto.TransformExpression\",\n                  \"initialValue\": {\n                    \"referenceValue\": \"~x\"\n                  },\n                  \"transformationFunctions\": [{\n                    \"functionType\": {\n                      \"stringFunction\": {\n                        \"functionName\": \"CONCAT\"\n                      }\n                    },\n                    \"parameters\": [{\n                      \"initialValue\": {\n                        \"referenceValue\": \"$textToAppend$\"\n                      }\n                    }]\n                  }]\n                }\n              }\n            }\n          }]\n        }, {\n          \"functionType\": {\n            \"jsonFunction\": {\n              \"functionName\": \"TO_STRING_ARRAY\"\n            }\n          }\n        }]\n      }\n    },\n    \"outputField\": {\n      \"referenceKey\": \"$stringArray$\",\n      \"fieldType\": \"STRING_ARRAY\",\n      \"cardinality\": \"OPTIONAL\"\n    }\n  }]\n}"
        }
      }
    },
    "taskExecutionStrategy": "WHEN_ALL_SUCCEED",
    "displayName": "Data Mapping"
  }],
  "integrationParameters": [{
    "key": "stringArray",
    "dataType": "STRING_ARRAY",
    "defaultValue": {
      "stringArray": {
        "stringValues": ["oranges", "apples", "bananas", "mangos"]
      }
    },
    "displayName": "stringArray",
    "inputOutputType": "OUT"
  }, {
    "key": "textToAppend",
    "dataType": "STRING_VALUE",
    "defaultValue": {
      "stringValue": "AreGreatFruits"
    },
    "displayName": "textToAppend"
  }]
}

Sample integration flow

The following image shows a sample layout of the integration editor for this integration code sample.

image showing the sample integration flow image showing the sample integration flow

Upload and run the sample integration

To upload and run the sample integration, do the following steps:

  1. Save the integration sample as a .json file on your system.
  2. In the Google Cloud console, go to the Application Integration page.

    Go to Application Integration

  3. In the navigation menu, click Integrations. The Integrations page appears.
  4. Select an existing integration or create a new integration by clicking Create integration.

    If you are creating a new integration:

    1. Enter a name and description in the Create Integration dialog.
    2. Select a region for the integration.
    3. Select a service account for the integration. You can change or update the service account details of an integration any time from the Integration summary pane in the integration toolbar.
    4. Click Create.

    This opens the integration in the integration editor.

  5. In the integration editor, click Upload/download menu and then select Upload integration.
  6. In the file browser dialog, select the file that you saved in step 1, and then click Open.

    A new version of the integration is created using the uploaded file.

  7. In the integration editor, click Test.
  8. Click Test integration. This runs the integration and displays the execution result in the Test Integration pane.