[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-03。"],[[["\u003cp\u003eThis guide demonstrates how to use Application Integration to invoke a sub-integration for sending email notifications.\u003c/p\u003e\n"],["\u003cp\u003eThe For Each Loop task in the main integration iterates through a list of email content, invoking a sub-integration for each item.\u003c/p\u003e\n"],["\u003cp\u003eThe sub-integration contains an EmailTask which is configured to send an email, using input parameters like "To", "Subject", and "TextBody".\u003c/p\u003e\n"],["\u003cp\u003eThe provided code samples show the JSON configurations for both the main integration (using For Each Loop) and the sub-integration (for sending email).\u003c/p\u003e\n"],["\u003cp\u003eInstructions are included on how to upload the provided integration code sample as a JSON file to Application Integration and run it for testing.\u003c/p\u003e\n"]]],[],null,["# Invoke a sub-integration to send an email\n\nSee the [supported connectors](/integration-connectors/docs/connector-reference-overview) for Application Integration.\n\nInvoke a sub-integration to send an email\n=========================================\n\n\nUsing the For Each Loop task, invoke a sub-integration that takes input from the main integration to send email notifications.\n\nCode sample: Sub-integration\n----------------------------\n\n {\n \"triggerConfigs\": [{\n \"label\": \"API Trigger\",\n \"startTasks\": [{\n \"taskId\": \"1\"\n }],\n \"properties\": {\n \"Trigger name\": \"SubIntegrationSendEmailDemo_API_1\"\n },\n \"triggerType\": \"API\",\n \"triggerNumber\": \"1\",\n \"triggerId\": \"api_trigger/SubIntegrationSendEmailDemo_API_1\"\n }],\n \"taskConfigs\": [{\n \"task\": \"EmailTask\",\n \"taskId\": \"1\",\n \"parameters\": {\n \"Cc\": {\n \"key\": \"Cc\",\n \"value\": {\n \"stringArray\": {\n }\n }\n },\n \"TextBody\": {\n \"key\": \"TextBody\",\n \"value\": {\n \"stringValue\": \"$EmailContent$\"\n }\n },\n \"Bcc\": {\n \"key\": \"Bcc\",\n \"value\": {\n \"stringArray\": {\n }\n }\n },\n \"AttachmentPath\": {\n \"key\": \"AttachmentPath\",\n \"value\": {\n \"stringArray\": {\n }\n }\n },\n \"To\": {\n \"key\": \"To\",\n \"value\": {\n \"stringArray\": {\n \"stringValues\": [\"$Recipients$\"]\n }\n }\n },\n \"BodyFormat\": {\n \"key\": \"BodyFormat\",\n \"value\": {\n \"stringValue\": \"text\"\n }\n },\n \"EmailConfigInput\": {\n \"key\": \"EmailConfigInput\",\n \"value\": {\n \"jsonValue\": \"{\\n \\\"@type\\\": \\\"type.googleapis.com/enterprise.crm.eventbus.proto.EmailConfig\\\"\\n}\"\n }\n },\n \"Subject\": {\n \"key\": \"Subject\",\n \"value\": {\n \"stringValue\": \"$Email_Subject$\"\n }\n }\n },\n \"taskExecutionStrategy\": \"WHEN_ALL_SUCCEED\",\n \"displayName\": \"Send Email\"\n }],\n \"integrationParameters\": [{\n \"key\": \"EmailContent\",\n \"dataType\": \"STRING_VALUE\",\n \"defaultValue\": {\n \"stringValue\": \"\"\n },\n \"displayName\": \"EmailContent\",\n \"inputOutputType\": \"IN\"\n }, {\n \"key\": \"Recipients\",\n \"dataType\": \"STRING_VALUE\",\n \"defaultValue\": {\n \"stringValue\": \"\"\n },\n \"displayName\": \"Recipients\",\n \"inputOutputType\": \"IN\"\n }, {\n \"key\": \"Email_Subject\",\n \"dataType\": \"STRING_VALUE\",\n \"defaultValue\": {\n \"stringValue\": \"\"\n },\n \"displayName\": \"Email_Subject\",\n \"inputOutputType\": \"IN\"\n }]\n }\n\nCode sample: Main Integration\n-----------------------------\n\n {\n \"triggerConfigs\": [{\n \"label\": \"API Trigger\",\n \"startTasks\": [{\n \"taskId\": \"1\"\n }],\n \"properties\": {\n \"Trigger name\": \"ForEachLoopDemo_API_1\"\n },\n \"triggerType\": \"API\",\n \"triggerNumber\": \"1\",\n \"triggerId\": \"api_trigger/ForEachLoopDemo_API_1\"\n }],\n \"taskConfigs\": [{\n \"task\": \"SubWorkflowForEachLoopV2Task\",\n \"taskId\": \"1\",\n \"parameters\": {\n \"iterationElementMapping\": {\n \"key\": \"iterationElementMapping\",\n \"value\": {\n \"stringValue\": \"EmailContent\"\n }\n },\n \"aggregatorParameterMapping\": {\n \"key\": \"aggregatorParameterMapping\"\n },\n \"triggerId\": {\n \"key\": \"triggerId\",\n \"value\": {\n \"stringValue\": \"api_trigger/SubIntegrationSendEmailDemo_API_1\"\n }\n },\n \"loopMetadata\": {\n \"key\": \"loopMetadata\",\n \"value\": {\n \"stringArray\": {\n \"stringValues\": [\"$`Task_1_loopMetadata`$\"]\n }\n }\n },\n \"disableEucPropagation\": {\n \"key\": \"disableEucPropagation\",\n \"value\": {\n \"booleanValue\": false\n }\n },\n \"listToIterate\": {\n \"key\": \"listToIterate\",\n \"value\": {\n \"stringValue\": \"$ListOfEmailContent$\"\n }\n },\n \"workflowName\": {\n \"key\": \"workflowName\",\n \"value\": {\n \"stringValue\": \"SubIntegrationSendEmailDemo\"\n }\n },\n \"requestParameterMapping\": {\n \"key\": \"requestParameterMapping\",\n \"value\": {\n \"jsonValue\": \"{\\n \\\"@type\\\": \\\"type.googleapis.com/enterprise.crm.eventbus.proto.ParameterMap\\\",\\n \\\"entries\\\": [{\\n \\\"key\\\": {\\n \\\"literalValue\\\": {\\n \\\"stringValue\\\": \\\"Recipients\\\"\\n }\\n },\\n \\\"value\\\": {\\n \\\"literalValue\\\": {\\n \\\"stringValue\\\": \\\"Recipients\\\"\\n }\\n }\\n }, {\\n \\\"key\\\": {\\n \\\"literalValue\\\": {\\n \\\"stringValue\\\": \\\"Email_Subject\\\"\\n }\\n },\\n \\\"value\\\": {\\n \\\"literalValue\\\": {\\n \\\"stringValue\\\": \\\"Email_Subject\\\"\\n }\\n }\\n }]\\n}\"\n }\n },\n \"overrideParameterMapping\": {\n \"key\": \"overrideParameterMapping\"\n }\n },\n \"taskExecutionStrategy\": \"WHEN_ALL_SUCCEED\",\n \"displayName\": \"For Each Loop\"\n }],\n \"integrationParameters\": [{\n \"key\": \"`Task_1_loopMetadata`\",\n \"dataType\": \"JSON_VALUE\",\n \"displayName\": \"`Task_1_loopMetadata`\",\n \"isTransient\": true,\n \"producer\": \"1_1\"\n }, {\n \"key\": \"Recipients\",\n \"dataType\": \"STRING_VALUE\",\n \"defaultValue\": {\n \"stringValue\": \"\"\n },\n \"displayName\": \"Recipients\",\n \"inputOutputType\": \"IN\"\n }, {\n \"key\": \"Email_Subject\",\n \"dataType\": \"STRING_VALUE\",\n \"defaultValue\": {\n \"stringValue\": \"\"\n },\n \"displayName\": \"Email_Subject\",\n \"inputOutputType\": \"IN\"\n }, {\n \"key\": \"ListOfEmailContent\",\n \"dataType\": \"STRING_ARRAY\",\n \"defaultValue\": {\n \"stringArray\": {\n \"stringValues\": [\"\\\"Content 1\\\"\", \"\\\"Content 2\\\"\", \"\\\"Content 3\\\"\", \"\\\"Content 4\\\"\"]\n }\n },\n \"displayName\": \"ListOfEmailContent\",\n \"inputOutputType\": \"IN\"\n }]\n }\n\n### Sample integration flow\n\nThe following images shows a sample layout of the integration editor for this integration code sample.\n\n### Sub-integration\n\n\n### Main Integration\n\n\nUpload and run the sample integration\n-------------------------------------\n\nTo upload and run the sample integration, do the following steps:\n\n1. Save the [integration sample](#code-sample) as a .json file on your system.\n2. In the Google Cloud console, go to the **Application Integration** page.\n\n [Go to Application Integration](https://console.cloud.google.com/integrations)\n3. Click **Integrations** from the left navigation menu to open the **Integrations** page.\n4. Select an existing integration or create a new integration by clicking **Create integration** .\n\n\n If you are creating a new integration:\n 1. Enter a name and description in the **Create Integration** dialog.\n 2. Select a region for the integration. **Note:** The **Regions** dropdown only lists the regions provisioned in your Google Cloud project. To provision a new region, Click **Enable Region** . See [Enable new region](/application-integration/docs/enable-new-region) for more information.\n 3. Select a service account for the integration. You can change or update the service account details of an integration any time from the info **Integration summary** pane in the integration toolbar. **Note:** The option to select a service account is displayed only if you have enabled integration governance for the selected region.\n 4. Click **Create**.\n\n\n This opens the integration in the *integration editor*.\n5. In the *integration editor* , click publish**Upload/download menu** and then select **Upload integration**.\n6. In the file browser dialog, select the file that you saved in step 1, and then click **Open** .\n\n A new version of the integration is created using the uploaded file.\n7. In the *integration editor* , click **Test**.\n8. Click **Test integration** . This runs the integration and displays the execution result in the **Test Integration** pane."]]