Tugas While Loop memungkinkan Anda melakukan panggilan berulang ke sub-integrasi dari
integrasi (utama) saat ini hingga kondisi yang ditentukan terpenuhi.
API Trigger ID dan Integration name mengidentifikasi sub-integrasi yang ingin Anda jalankan.
Tugas ini juga memungkinkan Anda mengumpulkan respons dari setiap sub-integrasi yang dijalankan dan menyimpan nilai dalam
integrasi saat ini untuk digunakan dalam tugas downstream. Anda dapat menggunakan salah satu pendekatan berikut untuk mengumpulkan respons:
Gabungkan respons dari setiap operasi dalam variabel array, dengan setiap elemen array memiliki respons dari satu operasi tertentu. Untuk menggabungkan respons, konfigurasikan properti Collect values from sub-integration output(s).
Gabungkan respons dari semua operasi dalam satu variabel. Untuk menggabungkan respons, konfigurasikan properti Override values from sub-integration output(s).
Sebelum memulai
Pastikan Anda telah melampirkan akun layanan yang dikelola pengguna ke integrasi. Jika integrasi Anda tidak memiliki akun layanan yang dikelola pengguna yang dikonfigurasi, secara default akun layanan default (service-PROJECT_NUMBER@gcp-sa-integrations.) akan digunakan untuk autentikasi.
Pastikan akun layanan Anda memiliki peran IAM Application Integration Invoker. Untuk informasi tentang cara memberikan peran ke akun layanan, lihat Mengelola akses ke akun layanan.
Properti konfigurasi
Tabel berikut menjelaskan properti konfigurasi tugas While Loop.
Properti
Data type
Deskripsi
API Trigger ID
String
ID pemicu sub-integrasi yang akan dijalankan.
Nilai ini tersedia di kolom ID Pemicu dari Pemicu API
di sub-integrasi.
Integration name
String
Nama sub-integrasi yang akan dijalankan.
While loop condition
T/A
Kondisi untuk menghentikan loop. Sub-integrasi berjalan hingga kondisi terpenuhi. Misalnya, $loopMetadata.current_iteration_count$< 10.
Map to sub-integration input(s)
T/A
Nilai yang akan diteruskan dari integrasi saat ini ke sub-integrasi.
Nilai properti ini berupa pasangan nilai kunci, dengan kunci adalah variabel
dalam integrasi saat ini, dan nilainya adalah variabel input yang sesuai dalam
sub-integrasi. Misalnya, integrasi utama Anda memiliki variabel productID, yang ingin Anda petakan ke variabel sub-integrasi subIntProductID. Anda akan memilih productID dari drop-down Variabel integrasi untuk dipetakan dari dan memasukkan subIntProductID di kolom Input Sub-Integrasi untuk dipetakan ke.
Collect values from sub-integration output(s)
T/A
Gabungkan hasil dari sub-integrasi yang dijalankan.
Setiap kali sub-integrasi berjalan,
Anda dapat menyimpan output sub-integrasi dalam variabel array integrasi saat ini. Masukkan variabel output sub-integrasi di kolom Output Sub-Integrasi untuk dikumpulkan dari dan pilih variabel array dalam integrasi saat ini dari drop-down Variabel integrasi untuk dikumpulkan ke dalam. Setiap elemen array memiliki respons dari
sub-integrasi tertentu yang dijalankan. Misalnya, jika variabel array adalah resultsArray,
resultsArray[0] memiliki respons dari operasi pertama dan resultsArray[1] memiliki
respons dari operasi kedua.
Override values from sub-integration output(s)
T/A
Baca variabel output dari sub-integrasi yang dijalankan dan simpan dalam variabel
integrasi saat ini.
Pilih variabel output sub-integrasi dari drop-down Output sub-integrasi yang akan dipetakan, dan pilih variabel yang sesuai dalam integrasi saat ini dari drop-down Variabel integrasi yang akan diganti. Anda dapat mengirim variabel yang diganti dalam integrasi saat ini
ke sub-integrasi berikutnya yang dijalankan dengan memetakan variabel di properti Peta ke input sub-integrasi
tambahan. Akibatnya, Anda dapat menggabungkan respons secara kumulatif dari
sub-integrasi yang berjalan.
Loop metadata
Array JSON
Variabel output yang memiliki detail eksekusi sub-integrasi berjalan seperti ID eksekusi sub-integrasi, pesan error, dan nilai variabel yang diteruskan selama eksekusi. Metadata loop berisi variabel termasuk variabel output berikut: current_iteration_count, sub_integration_execution_ids, failure_location, current_element, iteration_element, dan failure_message.
Praktik terbaik
Untuk mengetahui informasi tentang batas penggunaan yang berlaku untuk tugas While Loop, lihat Batas penggunaan.
Strategi penanganan error
Strategi penanganan error untuk tugas menentukan tindakan yang akan diambil jika tugas gagal karena error sementara. Untuk mengetahui informasi tentang cara menggunakan strategi penanganan error, dan untuk mengetahui berbagai jenis strategi penanganan error, lihat Strategi penanganan error.
Kuota dan batas
Untuk mengetahui informasi tentang kuota dan batas, lihat Kuota dan batas.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-03 UTC."],[[["\u003cp\u003eThe While Loop task enables repeated execution of a sub-integration until a specified condition is met, identified by the API Trigger ID and Integration name.\u003c/p\u003e\n"],["\u003cp\u003eResponses from each sub-integration run can be collected and stored, either by collating each run's response into an array or by aggregating all responses into a single variable.\u003c/p\u003e\n"],["\u003cp\u003eThe While Loop task has a maximum limit of 8000 iterations, and the cumulative data collected from sub-integration runs cannot exceed 50 MB.\u003c/p\u003e\n"],["\u003cp\u003eA user-managed service account with the Application Integration Invoker role is required for the integration to run, or it will use the default service account.\u003c/p\u003e\n"],["\u003cp\u003eThe task configuration allows mapping variables between the current integration and the sub-integration, managing loop termination conditions, and collecting or overriding sub-integration outputs.\u003c/p\u003e\n"]]],[],null,["# While Loop task\n\nSee the [supported connectors](/integration-connectors/docs/connector-reference-overview) for Application Integration.\n\nWhile Loop task\n===============\n\nThe **While Loop** task lets you make repeated calls to a sub-integration from\nyour current (main) integration until a specified condition is met.\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 `Override values from sub-integration output(s)` property.\n\n| **Note** :\n|\n| - The **While Loop** task can run a maximum of 8000 iterations. This constraint holds good even if the configured condition results in an infinte loop.\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\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 **While Loop** task.\n\nBest practices\n--------------\n\nFor information about the usage limits that apply to the **While 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)."]]