Identity History Data Looping

Hi ,

I am doing a workflow POC on whether the user had access to a particular “app”, now i got stuck in looping the output I got from Get-Identity-History step. Has anyone know how to loop a list inside another list?
For example

Thanks,
Karthi

Hi @Karthikeyan_U ,

Currently workflows doesn’t support loop within a loop.

Can you try below approach, I think this should work for your case:

  1. Loop Action with below input and context (previous step is Get Identity History action)

Loop Input:$.getIdentityHistory.identityHistories
Context: $.getIdentityHistory.identityHistories

  1. Within the loop, a Compare String step to compare the value of the cloudAppName with your desired App Name

Value 1: $.loop.loopInput.accessItem.appRefs[0].cloudAppName
Value 2: You can specify the required app name

  1. You can adjust the True and False flows as per your requirement.

HTH.

Thanks,
Shailee

Hi Shailee,

Thanks for your input.
I have tried the different way to get the Identity History by using the Http API request Based on the result the looping execution works fine, however I am not getting the actual output (didn’t receive email).

Loop : $.hTTPRequest.body
Loop Context: $.hTTPRequest.body
Compare String: $.loop.loopInput.accessItem.appRefs[0].cloudAppName

Thanks,
Karthi

Hi @Karthikeyan_U ,

This should work. Is the name of the Value 2 correct?

Hi Shailee,

The Value 2 is exactly matching with Value 1. I totally suspect the Compare Strings is not working properly. I have check each and every letters in Value 1 and Value 2 manually, it’s perfectly matching. Moreover inside the loop if I just keep send email without any condition and referring ($.loop.loopInput.accessItem.appRefs[0].cloudAppName) this gives me the exactly value in the email. So, something wrong with the compare string, it’ seems to be a bug.

Regards,
Karthi

Can you try “StartsWith” operator instead of “Equals”

Tried all the different options available in the Compare Strings, but none helped.

Hi @Karthikeyan_U ,

I relooked your workflow, what is the “Compare timestamps” step doing?

Hi Shailee,
There is a “dateTime” attribute in the Identity History result, I am comparing that value with another one defined in the define variable step which is now - 2d. This is to check and validate the recent activity. Both are dates are in the same format

For example:
Defined Value: 2024-09-21T05:33:07.964Z
IH dateTime: 2024-09-22T09:20:19.058Z

Regards,
Karthi

Hi @Karthikeyan_U ,

This comparison for timestamps also should work fine. Both dates are required to be in ISO8601 format as above

Hi Shailee,

How to convert the date inside the loop to ISO format? is there a way we can do that?

Thanks,
Karthi

Hi @Karthikeyan_U ,

The format of dates you have shared is fine. Can you share your full workflow json. Please mask the necessary.

Thanks,
Shailee

Hi Shailee,

Shared the workflow json in the chat window.

Thanks,
Karthi

Hi @Karthikeyan_U ,

Replied accordingly.

The String comparator in the loop should be evaluating correctly now.

Thanks,
Shailee