# Workflow search query issue

**URL:** <https://developer.sailpoint.com/discuss/t/workflow-search-query-issue/33455>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, sailpoint-identity-security\
**Created:** [March 4, 2024, 11:22pm UTC](https://developer.sailpoint.com/discuss/t/workflow-search-query-issue/33455 "2024-03-04T23:22:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdisharmaOz](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/adisharmaoz/32/17734_2.png) [@AdisharmaOz](https://developer.sailpoint.com/discuss/u/AdisharmaOz)\
**Post date:** [March 4, 2024, 11:22pm UTC](https://developer.sailpoint.com/discuss/t/workflow-search-query-issue/33455/1 "2024-03-04T23:22:37Z")

</div>

Hi Experts-  
I have created a workflow which uses an external trigger to get email ID and send a notification to the user.

 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/0/0325bc417839be84b43bbb39d8b13acc7640b979.png)

However even when I am passing an email which does not exists in IDN tenant - the workflow seem to traverse through all the users and send notification to the first one.  
In the “get list of identities” box which is essentially a search query,I am passing the email passed by trigger above “$.trigger.email” and then using it in the next step of Get-identity “$.getListOfIdentities.identities[0].id” .

This should ideally fail if the email does not exist in IDN but its not.  
Wondering if anyone has faced this issue before or has any better way of implementing the same?

---

<div class="post-metadata">

**Author:** ![KRM7](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/krm7/32/2685_2.png) [@KRM7](https://developer.sailpoint.com/discuss/u/KRM7)\
**Post date:** [March 5, 2024, 6:15am UTC](https://developer.sailpoint.com/discuss/t/workflow-search-query-issue/33455/2 "2024-03-05T06:15:41Z")

</div>

Hi Aditya,

Can you paste the JSON of the workflow, so that we can replicate the issue.

Thanks  
Krish

---

<div class="post-metadata">

**Author:** ![mehuljogi](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/mehuljogi/32/8264_2.png) [@mehuljogi](https://developer.sailpoint.com/discuss/u/mehuljogi)\
**Post date:** [March 5, 2024, 9:16am UTC](https://developer.sailpoint.com/discuss/t/workflow-search-query-issue/33455/3 "2024-03-05T09:16:38Z")

</div>

Hello Aditya,

In the 2nd step of your workflow, I see that you are passing the e-mail address to the search to get a list of identities.

However, when I made similar searches using search. I found that if you specify any search query without double quotes, you would get similar result and not exact result. if you specify search query with double quotes, you would get exact result.

For example, when I had searched for an email address without double quotes that did not exist on tenant, I still get list of identities. as shown below:

 ![AMB2](https://global.discourse-cdn.com/sailpoint/original/2X/4/4320388aa63f065ab8ab8e82b9611c7ce7dddba6.jpeg)

When I try to search using double quotes, I get the exact result. As shown below:

 ![AMB3](https://global.discourse-cdn.com/sailpoint/original/2X/9/9edfad148ed1f533efee2dadf24d194f8e4fa799.jpeg)

I think this is the similar thing happening to your workflow. email address coming from the external trigger passed to search gives similar results and not the exact results.so workflow is not working as expected.

Try specifying the search query in the workflow in the following way so that you get an exact result and the workflow works as expected.  
 ![AMB4](https://global.discourse-cdn.com/sailpoint/original/2X/1/17e149cd0ac94f729597b9d275a7f1fd2d58b2ce.jpeg)

---

<div class="post-metadata">

**Author:** ![kavindar\_sharma](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/kavindar_sharma/32/4766_2.png) [@kavindar\_sharma](https://developer.sailpoint.com/discuss/u/kavindar_sharma)\
**Post date:** [March 5, 2024, 9:51am UTC](https://developer.sailpoint.com/discuss/t/workflow-search-query-issue/33455/4 "2024-03-05T09:51:18Z")

</div>

Hi @AdisharmaOz ,

Could you please upload JSON object. Also I believe the recipient email address will be something like $.getIdentity.attributes.email to get the email address.

Thanks,  
Kavindar Sharma

---

<div class="post-metadata">

**Author:** ![AdisharmaOz](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/adisharmaoz/32/17734_2.png) [@AdisharmaOz](https://developer.sailpoint.com/discuss/u/AdisharmaOz)\
**Post date:** [March 5, 2024, 11:26pm UTC](https://developer.sailpoint.com/discuss/t/workflow-search-query-issue/33455/5 "2024-03-05T23:26:03Z")

</div>

Hi Mehul - This suggestion worked, however noticed that in case of fail scenarios the workflow used to take more time in processing. I then optimized the query like - [attributes.email:"test@test.com](mailto:attributes.email:%22test@test.com)" which reduced overall processing time and seems to work fine now 🙂 .  
Thanks to rest of the guys for their comments as well, really appreciate 🙂

Adi

---

<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:** [May 4, 2024, 11:26pm UTC](https://developer.sailpoint.com/discuss/t/workflow-search-query-issue/33455/6 "2024-05-04T23:26:24Z")

</div>

Closed on May 4, 2024, 11:26pm UTC

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