# Problems with the loop execution

**URL:** <https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281>\
**Category:** SHF Discussion and Questions\
**Tags:** identity-security-cloud, workflows\
**Created:** [July 23, 2025, 2:40pm UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281 "2025-07-23T14:40:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeross](https://avatars.discourse-cdn.com/v4/letter/z/bcef8e/32.png) [@zeross](https://developer.sailpoint.com/discuss/u/zeross)\
**Post date:** [July 23, 2025, 2:40pm UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/1 "2025-07-23T14:40:40Z")

</div>

I have created an workflow

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/6/f/6f6ce38d9cfdecba265017d23cc39641ea1547ff.png)

But I get error’s in my loop and I cannot figure it out where it is. I have also read the documentation about loops but still can’t figure out where it goes wrong.

In the loop I want only the identity ID’s going inside the loop to have less data. How can I do this?

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/8/0/80c767b196b4c307769a7be03306324134948c18.png)

Also with those identity ID’s I want to do some search actions. Where I have the following code in the request Body, is that loop.loopinput.id correct?

```auto
{"indices":["identities"],"query":{"innerHit":{"query":"disabled:true","type":"accounts"},"query":"id:{{$.loop.loopInput.id}}"}}

```

---

<div class="post-metadata">

**Author:** ![HussainshaSyed001](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/hussainshasyed001/32/28234_2.png) [@HussainshaSyed001](https://developer.sailpoint.com/discuss/u/HussainshaSyed001)\
**Post date:** [July 23, 2025, 3:44pm UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/2 "2025-07-23T15:44:21Z")

</div>

are you able to see what is the error?

---

<div class="post-metadata">

**Author:** ![iamnithesh](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/iamnithesh/32/42445_2.png) [@iamnithesh](https://developer.sailpoint.com/discuss/u/iamnithesh)\
**Post date:** [July 23, 2025, 4:03pm UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/3 "2025-07-23T16:03:01Z")

</div>

> [@zeross](#):
>
> But I get error’s in my loop and I cannot figure it out where it is. I have also read the documentation about loops but still can’t figure out where it goes wrong.

A loop has a maximum capacity of 100 items in the input. Is it the error you are getting?

---

<div class="post-metadata">

**Author:** ![JRDensmore](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jrdensmore/32/2829_2.png) [@JRDensmore](https://developer.sailpoint.com/discuss/u/JRDensmore)\
**Post date:** [July 23, 2025, 5:54pm UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/4 "2025-07-23T17:54:28Z")

</div>

I believe that was updated to 250 items. See [Workflow Operators - SailPoint Identity Services](https://documentation.sailpoint.com/saas/help/workflows/workflow-operators.html)

> The array you select can contain a maximum of 250 items. If your loop input exceeds the maximum of 250 items, the workflow will fail and exit.

@zeross  
We’ll want the error to be of better support, but this thread may help:

> [@Get List of Identities breaking loop in Workflows](https://developer.sailpoint.com/discuss/t/get-list-of-identities-breaking-loop-in-workflows/83195/3):
>
> Hi Mohamad, Yes, the Get List of Identities action will return all attributes of an identity, which can be an enormous amount of information depending on how many accounts and access your identities have. At the time of my reply, Workflows have the following limitation: The maximum allowed size for a workflow definition is 400KB. The maximum allowed size for a workflow definition plus its input is 1.5MB Additionally, loops have the following limit at the time of this reply: The array you…

---

<div class="post-metadata">

**Author:** ![udayputta](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/udayputta/32/14195_2.png) [@udayputta](https://developer.sailpoint.com/discuss/u/udayputta)\
**Post date:** [July 23, 2025, 7:01pm UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/5 "2025-07-23T19:01:51Z")

</div>

I replicated some of your steps like get list of identies, loop and do a search with the same query I am able to get the identity id inside the loop and able to do a search to find disabled accounts. can you make sure you are passing exactly like this in your search http operation inside the loop

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/5/f/5f889838676cd82019b9ab8f4ff7720bf02ae0db.png)

One suggestion here in your get list of identities you can also use a query to fetch identities with disabled accounts using this query. This will allow you to get only identities that has disabled accounts and you can narrow down your list of identities

```auto
@accounts(disabled:true)

```

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/6/6/66ef6b7b7aa4b5271fd646c8df1d4e26f60a4b97.png)

---

<div class="post-metadata">

**Author:** ![zeross](https://avatars.discourse-cdn.com/v4/letter/z/bcef8e/32.png) [@zeross](https://developer.sailpoint.com/discuss/u/zeross)\
**Post date:** [July 24, 2025, 5:28am UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/6 "2025-07-24T05:28:36Z")

</div>

The error I got was:

```auto
},
        "loop": {
          "loopOutput": {
            "failureItems": [
              {
                "errorMessage": "task failed: activity error (type: sp:email:send:v2, scheduledEventID: 29, startedEventID: 30, identity: 1@sp-workflow-worker-stg-eu-central-1-7d9ffd945c-kx2sc@sp-workflow-engine): unable to send email: request failed (type: Bad Request, retryable: false): 400 - 400 Bad Request (type: HTTP Response Returned a Client Error, retryable: false): request failed (type: Bad Request, retryable: false): 400 - 400 Bad Request (type: fundamental, retryable: true)",
                "payload": null
              },

```

And this 7 times, because 7 identities came into the loop.

It looked to me it’s in the send email function. But that thing is very basic and have done nothing weird in it, and used it the same as in my other workflows.

---

<div class="post-metadata">

**Author:** ![zeross](https://avatars.discourse-cdn.com/v4/letter/z/bcef8e/32.png) [@zeross](https://developer.sailpoint.com/discuss/u/zeross)\
**Post date:** [July 24, 2025, 5:32am UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/7 "2025-07-24T05:32:11Z")

</div>

My getIdentities have this query

```auto
attributes.endDate:[now-92d TO now-35d]

```

Because I want to check for these population if there are still open accounts or roles/entitlements granted.

---

<div class="post-metadata">

**Author:** ![zeross](https://avatars.discourse-cdn.com/v4/letter/z/bcef8e/32.png) [@zeross](https://developer.sailpoint.com/discuss/u/zeross)\
**Post date:** [July 24, 2025, 8:44am UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/8 "2025-07-24T08:44:43Z")

</div>

Weird stuff. I just removed the email task, and added a new one with the same settings.  
And the error is gone.

I can continue now on my workflow.

---

<div class="post-metadata">

**Author:** ![zeross](https://avatars.discourse-cdn.com/v4/letter/z/bcef8e/32.png) [@zeross](https://developer.sailpoint.com/discuss/u/zeross)\
**Post date:** [July 24, 2025, 1:02pm UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/9 "2025-07-24T13:02:39Z")

</div>

One thing I cannot get working. I want to check if the variable entitlement is not empty, but its not working.

The entitlement variable json context:

```auto
{
  "_type": "identity",
  "_version": "v2",
  "access": [
    {
      "displayName": "Ketentest_Beheerder_AD",
      "type": "ENTITLEMENT"
    },
    {
      "displayName": "MDT CRM Help & Training",
      "type": "ENTITLEMENT"
    }
}

```

This is the code in the email template

```auto
#if ( ${entitlement.length()} > 0 )
<p>De volgende rechten zijn nog toegekend:</p>
<ul>#foreach ( $i in ${entitlement} )
<li>$i</li>
</ul>
#end

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [September 22, 2025, 1:03pm UTC](https://developer.sailpoint.com/discuss/t/problems-with-the-loop-execution/159281/10 "2025-09-22T13:03:16Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
