# Workflow Loop is not working for multiple condition?

**URL:** <https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, sailpoint-identity-security\
**Created:** [November 26, 2024, 4:38pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962 "2024-11-26T16:38:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 26, 2024, 4:38pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/1 "2024-11-26T16:38:23Z")

</div>

Hi All,  
I have defined the WF and use the loop to get the multiple UPN from Entra ID source but recieving the “Unexpected End of JSON input”.

I want to get the UPN from multiple Entra ID source for the same user and revoke the signInSessions.

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/c/f/cfd4d20ac33b12d44a1dcedbe0513f6c1ba88903.png)  
 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/c/a/ca5aad7b42e2a20c240fa1da22afa7261c5d3e77.png)

In the HTTP Request i have given `https://graph.microsoft.com/v1.0/users/{{$.loop.loopInput.input}}/revokeSignInSessions`

```auto
{
“loopOutput”: {
“failureItems”: [
{
“errorMessage”: “unexpected end of JSON input”,
“payload”: null
},
{
“errorMessage”: “unexpected end of JSON input”,
“payload”: null
}
],
“successfulItems”: null
}
}

```

> [@Workflow in SailPoint IDN stopped revoking access for deactivated accounts, except roles – Anyone else experiencing this issue?](https://developer.sailpoint.com/discuss/t/workflow-in-sailpoint-idn-stopped-revoking-access-for-deactivated-accounts-except-roles-anyone-else-experiencing-this-issue/84425):
>
> I configured a workflow in SailPoint IdentityNow to revoke all access except roles for deactivated accounts. Until yesterday, everything was working perfectly. However, starting today, the workflow stopped mapping accounts as expected, as shown in the attached images. I’ve double-checked the configurations, and everything seems correct. Is anyone else facing this issue? step input { "context": "be9a1bc2c42546f5b926d0b8a6919ab4", "input": [ { "id": "b…

Any one resolved this issue or find the solution???

Thanks,  
Shantha Kumar

---

<div class="post-metadata">

**Author:** ![sidharth\_tarlapally](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sidharth_tarlapally/32/26178_2.png) [@sidharth\_tarlapally](https://developer.sailpoint.com/discuss/u/sidharth_tarlapally)\
**Post date:** [November 26, 2024, 5:11pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/3 "2024-11-26T17:11:02Z")

</div>

Hi @Santhakumar ,

I believe we cannot use _filtered JSON expression_ in the input .  
Instead take all the accounts and use compare string operator in the loop .

Thanks

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 26, 2024, 5:13pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/4 "2024-11-26T17:13:59Z")

</div>

I have tested this in dev tenant its working fine for me, but it’s not working for fedramp tenant. If we can proceed with compare strings can you give me the outline.

---

<div class="post-metadata">

**Author:** ![sidharth\_tarlapally](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sidharth_tarlapally/32/26178_2.png) [@sidharth\_tarlapally](https://developer.sailpoint.com/discuss/u/sidharth_tarlapally)\
**Post date:** [November 26, 2024, 5:28pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/5 "2024-11-26T17:28:59Z")

</div>

![image](https://global.discourse-cdn.com/sailpoint/original/3X/c/9/c955001bc118fa1079d5949999ef27cdaeb29af9.png)

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/9/4/9445ad63b2024da088ce0b7790ed0bd2732cfef7.png)

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 26, 2024, 5:40pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/6 "2024-11-26T17:40:52Z")

</div>

If i use compare strings what i can give this in next http request.

```auto
https://graph.microsoft.com/v1.0/users/{{upn}}/revokeSignInSessions

```

---

<div class="post-metadata">

**Author:** ![sidharth\_tarlapally](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sidharth_tarlapally/32/26178_2.png) [@sidharth\_tarlapally](https://developer.sailpoint.com/discuss/u/sidharth_tarlapally)\
**Post date:** [November 26, 2024, 5:46pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/7 "2024-11-26T17:46:47Z")

</div>

The loop input which is _accountId_ and satisfies _sourceName_ , need to act in next operation , thus the the account id is : `{{$.loop.loopInput.id}}`

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 26, 2024, 5:48pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/8 "2024-11-26T17:48:15Z")

</div>

For the HTTP operation i don’t need an id/name i need an upn from the Entra ID source. How can i achieve this??

---

<div class="post-metadata">

**Author:** ![sidharth\_tarlapally](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sidharth_tarlapally/32/26178_2.png) [@sidharth\_tarlapally](https://developer.sailpoint.com/discuss/u/sidharth_tarlapally)\
**Post date:** [November 26, 2024, 6:05pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/9 "2024-11-26T18:05:01Z")

</div>

So , for an account who is on ENTRA Source , get that accounts upn value ?  
If my understanding is correct  
Use Get Accounts by Account ID after compare strings true

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

And now , the upn id will be `{{$.getAccounts.accounts[0].attributes.upn}}` , after this step add http and use upn .

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 26, 2024, 6:38pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/10 "2024-11-26T18:38:13Z")

</div>

Tried this but still facing the same error Unexpected end of JSON string.

---

<div class="post-metadata">

**Author:** ![sidharth\_tarlapally](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sidharth_tarlapally/32/26178_2.png) [@sidharth\_tarlapally](https://developer.sailpoint.com/discuss/u/sidharth_tarlapally)\
**Post date:** [November 26, 2024, 6:43pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/11 "2024-11-26T18:43:16Z")

</div>

Download the Workflow Execution And check if you can find which step is throwing error .  
Send the workflow execution if possible

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 26, 2024, 6:51pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/12 "2024-11-26T18:51:49Z")

</div>

![image](https://global.discourse-cdn.com/sailpoint/original/3X/2/5/254c385f2e13e03f530fd1d6b43d19e084de65eb.png)  
I have seen this error in the WF.

---

<div class="post-metadata">

**Author:** ![sk8er23](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sk8er23/32/19357_2.png) [@sk8er23](https://developer.sailpoint.com/discuss/u/sk8er23)\
**Post date:** [November 26, 2024, 7:14pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/13 "2024-11-26T19:14:07Z")

</div>

Do all of your accounts have the attribute userprincipal name defined

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 26, 2024, 7:22pm UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/14 "2024-11-26T19:22:09Z")

</div>

Yes all are having UPN.

---

<div class="post-metadata">

**Author:** ![sidharth\_tarlapally](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sidharth_tarlapally/32/26178_2.png) [@sidharth\_tarlapally](https://developer.sailpoint.com/discuss/u/sidharth_tarlapally)\
**Post date:** [November 27, 2024, 4:02am UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/15 "2024-11-27T04:02:48Z")

</div>

What is the URL that is you are passing in the Request URL

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 27, 2024, 5:42am UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/16 "2024-11-27T05:42:11Z")

</div>

[https://graph.microsoft.com/v1.0/users/{{$.getAccounts.accounts[0].attributes.upn}](https://graph.microsoft.com/v1.0/users/%7B%7B$.getAccounts.accounts%5B0%5D.attributes.upn%7D)}/revokeSignInSessions

---

<div class="post-metadata">

**Author:** ![kdfreeman](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/kdfreeman/32/22737_2.png) [@kdfreeman](https://developer.sailpoint.com/discuss/u/kdfreeman)\
**Post date:** [November 27, 2024, 7:32am UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/17 "2024-11-27T07:32:49Z")

</div>

You should be using

> {{$.loop.loopInput.name}}

to get the respective name about the account you sending to Http Request step. I don’t know what is the variable that you are fetching from account and sending into request, but you have to fetch like this according to your JSON response from “Get Accounts”

> {{$.loop.loopInput.variableName}}

See the sameple json from GetAccounts. You can check in your tenant what sample json you will get on “Get Accounts” step and use it accordingly. [Actions - SailPoint Identity Services](https://documentation.sailpoint.com/saas/help/workflows/workflow-actions.html#get-accounts)

> **[Operators - SailPoint Identity Services](https://documentation.sailpoint.com/saas/help/workflows/workflow-operators.html#loop)**
>
> SailPoint Identity Services Documentation

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 27, 2024, 7:35am UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/18 "2024-11-27T07:35:44Z")

</div>

I have already tried define variable to store the loop.loopInput it’s storing the upn values but when I tried to use $.defineVariable it was coming as empty outside the loop

---

<div class="post-metadata">

**Author:** ![kdfreeman](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/kdfreeman/32/22737_2.png) [@kdfreeman](https://developer.sailpoint.com/discuss/u/kdfreeman)\
**Post date:** [November 27, 2024, 7:44am UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/19 "2024-11-27T07:44:56Z")

</div>

Another thing you can check is, instead of using filter in Loop block, filter Accounts in “Get Accounts” block to filter only “Entra Id” accounts and send whole array in loop in next step and fetch the respective variable of array that will be sent in http request like the way I mentioned above.

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [November 27, 2024, 8:35am UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/20 "2024-11-27T08:35:39Z")

</div>

I have tried this but i cannot filter the source in the GetAccounts. Can you send the working json file if you have one. Or did i do something wrong  
[LoopWF20241127.json](https://developer.sailpoint.com/discuss/uploads/short-url/agagu9IMuMgSsT2OnZcCpCYvm9R.json) (2.1 KB)

---

<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:** [January 26, 2025, 8:36am UTC](https://developer.sailpoint.com/discuss/t/workflow-loop-is-not-working-for-multiple-condition/90962/21 "2025-01-26T08:36:18Z")

</div>

Closed on January 26, 2025, 8:36am UTC

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