Mit der Aufgabe Für jede Schleife können Sie wiederkehrende Aufrufe einer Subintegration von Ihrer Hauptintegration ausführen. Die Aufgabe durchläuft die konfigurierte Arrayvariable und ruft die Subintegration für jedes Element im Array auf. Die Häufigkeit, mit der die Subintegration aufgerufen wird, entspricht der Größe der Arrayvariable.
Die API-Trigger-ID und der Integrationsname identifizieren die Subintegration, die Sie ausführen möchten.
Mit der Aufgabe können Sie auch die Antwort von jeder Subintegrationsausführung erfassen und den Wert in Ihrer aktuellen Integration zur Verwendung in nachgelagerten Aufgaben speichern. Sie können die folgenden Methoden verwenden, um die Antworten zu erfassen:
Erfasst die Antwort jeder Ausführung in einer Arrayvariable, wobei jedes Element des Arrays die Antwort aus einer bestimmten Ausführung enthält. Konfigurieren Sie das Attribut Collect values from sub-integration output(s), um die Antworten zu erfassen.
Fassen Sie die Antworten aller Ausführungen in einer einzigen Variablen zusammen. Konfigurieren Sie das Attribut Response parameter override mapping, um die Antworten zusammenzufassen.
Hinweise
Achten Sie darauf, dass Sie Ihrer Integration ein nutzerverwaltetes Dienstkonto zugewiesen haben. Wenn für die Integration kein nutzerverwaltetes Dienstkonto konfiguriert ist, wird standardmäßig das Standarddienstkonto (service-PROJECT_NUMBER@gcp-sa-integrations.iam.gserviceaccount.com) zur Authentifizierung verwendet.
Achten Sie darauf, dass Ihrem Dienstkonto die IAM-Rolle Aufrufer der Anwendungsintegrationen zugewiesen ist. Informationen zum Zuweisen von Rollen zu einem Dienstkonto finden Sie unter Zugriff auf Dienstkonten verwalten.
Konfigurationsattribute
In der folgenden Tabelle werden die Konfigurationsattribute der Aufgabe Für jede Schleife beschrieben.
Attribut
Datentyp
Beschreibung
API Trigger ID
String
Trigger-ID der auszuführenden Subintegration.
Dieser Wert ist im Feld Trigger-ID des API-Triggers in der Subintegration verfügbar.
Integration name
String
Name der auszuführenden Subintegration.
List to iterate
Ein Array vom Typ String, Integer, Double oder JSON.
Liste der Werte, für die die Subintegration ausgeführt werden soll. Die Subintegration wird für jeden Wert in der Liste nacheinander ausgeführt.
Sie können den iterierten Wert an die Subintegration übergeben, indem Sie das Attribut Iterationselement-Subintegrationszuordnung festlegen. Geben Sie in diesem Attribut die Variable in der Subintegration an, der der iterierte Wert zugeordnet werden muss.
Iteration element sub-integration mapping
–
Variable in der Subintegration, für die das aktuelle iterierte Element zugewiesen werden muss.
Map to additional sub-integration input(s)
–
Zusätzliche Werte, die von der aktuellen Integration an die Subintegration übergeben werden sollen.
Die Werte dieses Attributs haben die Form von Schlüssel/Wert-Paaren, wobei der Schlüssel eine Variable in der aktuellen Integration und der Wert die entsprechende Eingabevariable in der Subintegration ist. Angenommen, Ihre Hauptintegration hat die Variable productID, die Sie der Subintegrationsvariablen subIntProductID zuordnen möchten. In diesem Fall würden Sie productID aus dem Drop-down-Menü Integrationsvariable, von der zugeordnet werden soll und subIntProductID im Drop-down-Menü Subintegrationseingabe, in die zugeordnet werden soll auswählen.
Collect values from sub-integration output(s)
–
Erfasst die Ergebnisse der Subintegrationsausführungen.
Jedes Mal, wenn die Subintegration ausgeführt wird, können Sie die Ausgabe der Subintegration in einer Arrayvariable der aktuellen Integration speichern.
Wählen Sie die Ausgabevariable der Subintegration aus dem Drop-down-Menü Subintegrationsausgabe, aus der erfasst werden soll und die Arrayvariable in der aktuellen Integration aus dem Drop-down-Menü Integrationsvariable, in die erfasst werden soll aus. Jedes Element des Arrays hat die Antwort einer bestimmten Subintegrationsausführung. Wenn die Arrayvariable beispielsweise resultsArray ist, hat resultsArray[0] die Antwort aus der ersten Ausführung und resultsArray[1] die Antwort aus der zweiten Ausführung.
Response parameter override mapping
–
Die Ausgabevariable einer Subintegrationsausführung lesen und in einer Variable der aktuellen Integration speichern.
Wählen Sie die Ausgabevariable der Subintegration aus dem Drop-down-Menü Subintegrationsausgabe, von der zugeordnet werden soll und dann die entsprechende Variable in der aktuellen Integration aus dem Drop-down-Menü Integrationsvariablen, die überschrieben werden soll aus. Sie können die überschriebene Variable in der aktuellen Integration an die nächste Ausführung der Subintegration senden, indem Sie die Variable im Attribut Weiteren Subintegrationseingaben zuordnen zuordnen. Dadurch können Sie die Antworten der Subintegrationsausführungen kumulativ zusammenfassen.
Loop metadata
JSON-Array
Die Ausgabevariable mit den Ausführungsdetails der Subintegration wie die Ausführungs-ID der Subintegration, Fehlermeldungen und Variablenwerten, die während der Ausführung übergeben werden. Die Metadaten der Schleife enthalten Variablen, darunter die folgenden Ausgabevariablen: current_iteration_count, sub_integration_execution_ids, failure_location, current_element, iteration_element und failure_message.
Best Practices
Informationen zu den Nutzungslimits für die Aufgabe Für jede Schleife finden Sie unter Nutzungslimits.
Fehlerbehebungsstrategie
Eine Strategie zur Fehlerbehandlung für eine Aufgabe legt die Aktion fest, die ausgeführt werden soll, wenn die Aufgabe aufgrund eines temporären Fehlers fehlschlägt. Informationen zur Verwendung einer Fehlerbehandlungsstrategie und zu den verschiedenen Arten von Fehlerbehandlungsstrategien finden Sie unter Strategien zur Fehlerbehebung.
Kontingente und Limits
Weitere Informationen zu allen Kontingenten und Limits finden Sie unter Kontingente und Limits.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-03 (UTC)."],[[["\u003cp\u003eThe For Each Loop task allows repeated execution of a sub-integration for each element within an array variable, where the number of iterations equals the array's size.\u003c/p\u003e\n"],["\u003cp\u003eSub-integrations are identified by their API Trigger ID and Integration name, and the task provides mechanisms to collect and utilize responses from each sub-integration run, including collating into an array or aggregating into a single variable.\u003c/p\u003e\n"],["\u003cp\u003eThe For Each Loop task has limits, including a maximum of 8000 iterations and a cumulative data collection size limit of 50 MB across all sub-integration runs.\u003c/p\u003e\n"],["\u003cp\u003eFailure of any sub-integration run within the For Each Loop task results in the failure of the entire task, though this can be mitigated through the use of an Execution strategy in the Join configuration.\u003c/p\u003e\n"],["\u003cp\u003eProper setup requires ensuring a user-managed service account is attached to the integration, with the service account having the necessary Application Integration Invoker IAM role.\u003c/p\u003e\n"]]],[],null,["# For Each Loop task\n\nSee the [supported connectors](/integration-connectors/docs/connector-reference-overview) for Application Integration.\n\nFor Each Loop task\n==================\n\nThe **For Each Loop** task lets you make repeated calls to a sub-integration from\nyour current (main) integration. The task iterates over the configured array variable and calls\nthe sub-integration for each element in the array. The number of times\nthe sub-integration is called is equal to the size of the array variable.\n\nThe **API Trigger ID** and the **Integration name** identifies the sub-integration you\nwant to run.\n\nThe task also lets you collect the response from each sub-integration run and store the value in your\ncurrent integration for use in downstream tasks. You can use any of the following approach to collect the responses:\n\n- Collate the response of each run in an array variable, where each element of the array has the response from one particular run. To collate the responses, configure the `Collect values from sub-integration output(s)` property.\n- Aggregate the responses of all the runs in a single variable. To aggregate the responses, configure the `Response parameter override mapping` property.\n\n| **Note** :\n|\n| - A **For Each Loop** task can run a maximum of 8000 iterations.\n| - The cumulative size of the data collected from each sub-integration run cannot exceed `50 MB`. If the size exceeds `50 MB`, the integration fails, and the downstream tasks are not run.\n| - If an integration in the **For Each Loop** task fails, then the entire task fails, and the downstream tasks are not run. To prevent failure of the entire integration you can specify an **Execution strategy** for the task in its *Join configuration pane* . See [Join](/application-integration/docs/forks-joins#join) for more details.\n\nBefore you begin\n----------------\n\n- Ensure that you have [attached a user-managed service account](/application-integration/docs/access-control#add-service-account) to your integration. If your integration does not have user-managed service account configured, then by default the [default service account](/application-integration/docs/access-control#default-service-account) (`service-`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`@gcp-sa-integrations.iam.gserviceaccount.com`) is used for authentication.\n- Ensure that your service account has the **Application Integration Invoker** IAM role. For information about granting roles to a service account, see [Manage access to service accounts](/iam/docs/manage-access-service-accounts).\n\nConfiguration properties\n------------------------\n\n\nThe following table describes the configuration properties of the **For Each Loop** task.\n\nBest practices\n--------------\n\nFor information about the usage limits that apply to the **For Each Loop** task, see [Usage limits](/application-integration/docs/quotas#usage-limits).\n\nError handling strategy\n-----------------------\n\n\nAn error handling strategy for a task specifies the action to take if the task fails due to a [temporary error](/application-integration/docs/error-handling). For information about how to use an error handling strategy, and to know about the different types of error handling strategies, see [Error handling strategies](/application-integration/docs/error-handling-strategy).\n\nQuotas and limits\n-----------------\n\nFor information about quotas and limits, see [Quotas and limits](/application-integration/docs/quotas).\n\nWhat's next\n-----------\n\n- Learn about [all tasks and triggers](/application-integration/docs/all-triggers-tasks).\n- Learn how to [test and publish an integration](/application-integration/docs/test-publish-integrations).\n\n- Learn about [error handling](/application-integration/docs/error-handling-strategy).\n- Learn about [integration execution logs](/application-integration/docs/introduction-logs)."]]