Executing Search event, looping through target.name and running an identity search for each target.name, and then pushing the results to sendEmail

Hello,

Having some development issues and struggling to use the builder but was wondering if this was even possible.

I am using a workflow and running a search query for lifecycle events for terminated users in the last 24 hours. I am returning the results, but queryResultFilter [target.name]. The target.name can sometimes be an account number, so I need more identifying factors. I am then trying to loop through the returned target.name json. For each target.name, implement an identity search to grab the displayName, email, and endDate for each target.name. After that I would like to print the results in a sendEmail action.

So my issue is, i’m struggling with the loop part in the builder and setting the right variables/context but i was wondering, is it even possible to grab each identity search result from the looped http request search query? I’m trying to see if this task is even possible.

Thanks,

Hi @SarakidaToy ,

Yes, it is possible to loop through your lifecycle event search results in a SailPoint workflow. Use a Loop operator to iterate over the target.name array, then inside the loop perform an identity search per target.name to retrieve displayName, email, and endDate. Collect these results and pass them to your SendEmail action.

Make sure to carefully manage workflow variables and context so each loop iteration processes the correct input and the identity search results are accessible for the email. Also, watch for limits on loop iteration counts and asynchronous behavior.

If possible, optimize by including needed identity attributes in your initial search to reduce looping and extra searches.

How would i go about carefully managing each workflow variable and context after each loop iteration? After each loop and search, i guess i’m confused about the logic of how each of the 3 attributes can be stored to be grabbed in send email. Like would the attribute coming from the search query have every looped attribute from each iteration stored inside?

So I resolved it sort of. I’ve gotten to a JSON array with a path expression that only generates the target.name. I am at the step of the workflow where i need to have some sort of dynamic variable that will grab each target.name and run the query. Is there something of a dynamic variable that can do that?

Resolved this issue. Current problem is while i’m inside the loop, i need to reference the current item/iteration target.name. Is there a jsonpathexpression that indicates this iteration of the loop? Like a currentItem or a $.loop.current?