# Unable to use loop input or loop context in loop steps

**URL:** <https://developer.sailpoint.com/discuss/t/unable-to-use-loop-input-or-loop-context-in-loop-steps/84404>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, sailpoint-identity-security\
**Created:** [October 8, 2024, 6:15pm UTC](https://developer.sailpoint.com/discuss/t/unable-to-use-loop-input-or-loop-context-in-loop-steps/84404 "2024-10-08T18:15:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dominick-miller](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/dominick-miller/32/29002_2.png) [@dominick-miller](https://developer.sailpoint.com/discuss/u/dominick-miller)\
**Post date:** [October 8, 2024, 6:15pm UTC](https://developer.sailpoint.com/discuss/t/unable-to-use-loop-input-or-loop-context-in-loop-steps/84404/1 "2024-10-08T18:15:58Z")

</div>

I have a workflow where I am unable to reference the loop input or loop context and I am not sure why.

In the Loop Input I am passing an http request’s response body ($.hTTPRequest.body) and in the Loop Context I am passing an earlier get Identity call ($.getIdentity).

I expect to be able to reference anything from the HTTP Request response body and anything from the get identity call within actions taken inside my loop.

What I am experiencing is the variable values appear as empty. For instance, one of the steps inside my loop is an HTTP operation to patch the sources we are iterating over. I am sending the following body:

```auto
[
    {
        "op": "replace",
        "path": "/owner",
        "value": {
            "id": "{{$.loop.context.id}}",
            "type": "IDENTITY"
        }
    }
]

```

For this, the json during execution appears as:

```auto
"jsonPatchRequestBody": [
  {
      "op": "replace",
      "path": "/owner",
      "value": {
          "id": "",
          "type": "IDENTITY"
      }
  }
]

```

I know the context is getting loaded correctly because in the workflow execution I see the context appear as expected:

```auto
"attributes": {
            "displayName": "Loop",
            "input": {
                "context": {
                                  "id": "123456",
.
.
.
                           }
                      }

```

Is there anything I am missing? I previously had this working and am wondering if a recent patch caused this workflow bug.

Note: it should be noted that in addition to the variables resolving as empty, I also receive the following error msg:

```auto
"attributes": {
            "displayName": "Loop",
            "result": {
                "loopOutput": {
                    "failureItems": [
                        {
                            "errorMessage": "unexpected end of JSON input",
                            "payload": null
                        }
                    ],
                    "successfulItems": null
                }
            },
            "stepName": "loop",
            "task": "sp:loop:iterator"
        }

```

---

<div class="post-metadata">

**Author:** ![shaileeM](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/shaileem/32/15314_2.png) [@shaileeM](https://developer.sailpoint.com/discuss/u/shaileeM)\
**Post date:** [October 14, 2024, 4:14am UTC](https://developer.sailpoint.com/discuss/t/unable-to-use-loop-input-or-loop-context-in-loop-steps/84404/2 "2024-10-14T04:14:30Z")

</div>

Hi @dominick-miller ,

Can you share the loop context value that’s being loaded during the workflow?

Thanks,  
Shailee

---

<div class="post-metadata">

**Author:** ![dominick-miller](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/dominick-miller/32/29002_2.png) [@dominick-miller](https://developer.sailpoint.com/discuss/u/dominick-miller)\
**Post date:** [October 16, 2024, 3:24pm UTC](https://developer.sailpoint.com/discuss/t/unable-to-use-loop-input-or-loop-context-in-loop-steps/84404/3 "2024-10-16T15:24:43Z")

</div>

Update: The issue is with using multiple loops in one workflow. I don’t think SailPoint supports this. My second loop was corrupt and there was nothing being done incorrectly. 😃

---

<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:** [December 15, 2024, 3:25pm UTC](https://developer.sailpoint.com/discuss/t/unable-to-use-loop-input-or-loop-context-in-loop-steps/84404/4 "2024-12-15T15:25:19Z")

</div>

Closed on December 15, 2024, 3:25pm UTC

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