API バージョン 56.0 以前の Salesforce フローで「Number of iterations exceeded」エラーが表示される原因と解決策を説明します。この問題は、ループ処理で実行される要素の数が実行時の上限である 2,000 を超えた場合に発生します。フローの API バージョン更新や、処理レコード数の削減で対応可能です。
Flow Builderの概要
この制限に達する理由は、レコードをループ処理する際に、ループ内の各要素がループするレコードごとに 1 回、つまり複数回実行済み要素としてカウントされるためです。
例えば、[レコードを取得]、[ループ] (取得したレコード結果をループ処理し、2 つの [割り当て] 要素で値を設定してコレクションに追加)、最後に [レコードを更新] を実行するフローを考えてみましょう。
実行される要素の数は、以下の式で計算されます。 [レコードを取得] 要素 (1) + [レコード数 * ループ内の要素数 (3)] + [レコードを更新] 要素 (1)
この合計値が 2,000 以下である必要があります。値が 2,000 を超えると、「Number of Iterations Exceeded」エラーが発生します。
このエラーを回避するためのいくつかの提案を以下に示します。
注意: これらの代替案はあくまで提案です。フローに関連する具体的な実装方法は、サポートの対象外となります。
フローの API バージョンを 57.0 以降に更新する。 API バージョン 57.0 で、フロー要素の上限 2,000 は撤廃されました。
処理するレコードの総数を減らす。
レコードを複数のバッチで処理する。 数値変数を使用して独自のカウンターを保持し、ループごとにインクリメントして、制限に達する直前にループを終了させる。次のレコードのバッチをループ処理する前に、画面要素または待機要素を追加することを検討する。
Apex コードを使用した代替案を検討する。
詳細は、Salesforce ヘルプの「フローの一般的な制限」をご参照ください。 また、ご利用中のバージョンは「Salesforce のエディションと API バージョンの確認」で確認できます。
000382258

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.