# Compare string not working in a loop

**URL:** <https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, sailpoint-identity-security\
**Created:** [September 20, 2024, 2:13pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044 "2024-09-20T14:13:40Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![zeel\_sinojia](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/zeel_sinojia/32/13666_2.png) [@zeel\_sinojia](https://developer.sailpoint.com/discuss/u/zeel_sinojia)\
**Post date:** [September 23, 2024, 12:39pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/21 "2024-09-23T12:39:45Z")

</div>

@Melaoon

Could you download the JSON config for your workflow and upload here? I’ll use the same to mimic your case.

Make sure to remove any sensitive data.

---

<div class="post-metadata">

**Author:** ![Melaoon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Melaoon](https://developer.sailpoint.com/discuss/u/Melaoon)\
**Post date:** [September 23, 2024, 12:48pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/22 "2024-09-23T12:48:46Z")

</div>

[CopyofBirthdaytest20240923.json](https://developer.sailpoint.com/discuss/uploads/short-url/rAdg1iQB8GSuhGz4VBzpgtJJSEH.json) (6.2 KB)  
I have replaced all sensitive data with \*\*\*\*\*

---

<div class="post-metadata">

**Author:** ![Melaoon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Melaoon](https://developer.sailpoint.com/discuss/u/Melaoon)\
**Post date:** [September 23, 2024, 12:51pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/23 "2024-09-23T12:51:16Z")

</div>

Define variable 4 is me hard coding the birthday but it will be replaced with variable 3 when everything works that is why I am calling variable 4 in the compare string and not variable 3

---

<div class="post-metadata">

**Author:** ![zeel\_sinojia](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/zeel_sinojia/32/13666_2.png) [@zeel\_sinojia](https://developer.sailpoint.com/discuss/u/zeel_sinojia)\
**Post date:** [September 23, 2024, 1:03pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/24 "2024-09-23T13:03:20Z")

</div>

I tried running the workflow with the modifications and it worked for me. I removed the HTTP calls and looping.

Could you try these 2 things ?

1. Update _Variable 4_ with value `09-23` and try running the workflow.
2. Instead of using _Variable 4_ in the comparison, could you use _Variable 3_ ?

Run these cases separately and let me know the result.

---

<div class="post-metadata">

**Author:** ![Melaoon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Melaoon](https://developer.sailpoint.com/discuss/u/Melaoon)\
**Post date:** [September 23, 2024, 1:09pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/25 "2024-09-23T13:09:58Z")

</div>

The issue with that is their is no one in the data with a birthday today. Does it matter what variable 4’s date is?

---

<div class="post-metadata">

**Author:** ![zeel\_sinojia](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/zeel_sinojia/32/13666_2.png) [@zeel\_sinojia](https://developer.sailpoint.com/discuss/u/zeel_sinojia)\
**Post date:** [September 23, 2024, 1:57pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/26 "2024-09-23T13:57:09Z")

</div>

No it doesn’t.

Sorry for spamming with so many questions but,

If I understand your workflow correctly, you are building the today’s date in the format mm-dd and sending a mail if anyone has their birthday today?

Maybe I missed it but when you say it works for static value and doesn’t work for a variable. Do you mean that the workflow fails or what happens?

It would not send any email as no one has their birthday today, right?

---

<div class="post-metadata">

**Author:** ![Melaoon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Melaoon](https://developer.sailpoint.com/discuss/u/Melaoon)\
**Post date:** [September 23, 2024, 2:04pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/27 "2024-09-23T14:04:16Z")

</div>

2 people have a birthday on 09-24. When I ran a test and type in “09-24” as a static value in both compare strings, I get 2 emails, one for each birthday. When I change the static value into variable4 which has 09-24 hard coded for testing purposes, I only get 1 email from 1 of the loops. Both loops show 100% success, but only one of them is working correctly

---

<div class="post-metadata">

**Author:** ![zeel\_sinojia](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/zeel_sinojia/32/13666_2.png) [@zeel\_sinojia](https://developer.sailpoint.com/discuss/u/zeel_sinojia)\
**Post date:** [September 23, 2024, 2:14pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/28 "2024-09-23T14:14:53Z")

</div>

In my tenant, the workflow executed successfully. I got 2 emails as well. 😅

Could you run a Test Workflow and share the `Workflow Output` JSON? Only thing I can think of is that.

---

<div class="post-metadata">

**Author:** ![jsosa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jsosa/32/31578_2.png) [@jsosa](https://developer.sailpoint.com/discuss/u/jsosa)\
**Post date:** [September 23, 2024, 2:21pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/29 "2024-09-23T14:21:44Z")

</div>

Hi Hassan! I have a compare string working now inside a loop. My suggestion is to create a Send Email box at the very first step inside loop. Then, put yourselve as destinatary, and in the mail body put the variable $.loop.loopInput.

That way, you will see what is resolved as the loop iteration, and would be more clear for you how to invoke some inner attribute.

---

<div class="post-metadata">

**Author:** ![Melaoon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Melaoon](https://developer.sailpoint.com/discuss/u/Melaoon)\
**Post date:** [September 25, 2024, 7:13am UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/30 "2024-09-25T07:13:20Z")

</div>

Hi, so when I do this I get an email for each accounts in the list so the loop is working, just not the compare

---

<div class="post-metadata">

**Author:** ![jsosa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jsosa/32/31578_2.png) [@jsosa](https://developer.sailpoint.com/discuss/u/jsosa)\
**Post date:** [September 25, 2024, 12:45pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/31 "2024-09-25T12:45:22Z")

</div>

I am guessing that error can be in the JSONPath. Can you share some email content?

---

<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:** [November 24, 2024, 12:45pm UTC](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044/32 "2024-11-24T12:45:33Z")

</div>

Closed on November 24, 2024, 12:45pm UTC

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

[Previous page](https://developer.sailpoint.com/discuss/t/compare-string-not-working-in-a-loop/82044.md?page=1)
