Compare string not working in a loop

Hi,

I am having issues with my compare sting operator. I am trying to compare an attribute with a variable. When I use use a static string value, it works but when I use a variable with the same value it fails. I need to use a variable because it will contain the current date

Any help would be appreciated

Hey ,

It appears you Are not using the loop variable properly.
You need to reference the array something like $.loopinpuit[0].attributes.birthday

3 Likes

Hi,

When I change the loop variable to how you did it, I get the error lines under my variable and also when I run the flow now, It doesn’t run correctly whether I use a variable or hard code the input as text
image

Even if I use $.loop.loopinpuit[0].attributes.birthday it wont work

I see that the compare string is adding a .$ to variable B. Does anyone know why this would be happening. I have 2 loops with the same compare string format, but 1 is working and the other is not and the only difference I can see is one of them adds the .$ to the variable which is causing it not to work
image
This one works

image
This one does not

Hello Hassan,

Have you looked at the JSON response for the loop? Based on the docs for loops your output should appear something like this. The reason that it was suggested to [0] is because this returns a list and you need to define which object in the list you want to target. By putting [0] you are telling the complier to grab the first object in the list then you a dot walking to the attribute in which you want to grab. I hope this helps.

{
    "loopOutput":{
        "failureItems":null,
        "successfulItems":[
            {
                "loopInput":"2c91503771f099950171e65c874d02cd"
            },
            {
                "loopInput":"2c91903771f099950571f65c8ac402fe"
            }
        ]
    }
}

The loop works, just the compare string is broken. I have two separate loops, one works but the other does not and they are identical
image

I am doing an Http requst before the loop and the loop goes through all the accounts pulled by the request

Could you share the “Define Variable” step config?



I have 3 variables that eventually make this string to get todays date in the format mm-dd
The 3rd screenshot is the variable I am trying to call

Have you also checked the output of this step when you run your test? It could be possible that you are actually passing a null value.

image

Where are you trying to pull the Birthday attribute from?

AD source.

I see that the compare string is adding a .$ to variable B. Can this be the issue?. I have 2 loops with the same compare string format, but 1 is working and the other is not and the only difference I can see is one of them adds the .$ to the variable which is causing it not to work


image
This one does not work
…

image

This one works

Now comes the fun part of trying to figure out why the one has .$ in it and the other one does not. If that is the only difference then I would think that would be why you are having issues. Now we just need to figure out why it is populating that way.

That’s what I’ve been trying to figure out for 2 days :smile:

Is it using the same define variable?

yes, both use the same variable, I have to do it this way because the data source is over 200 accounts and loops can only hold 100 accounts

That is actually supposed to happen. When you reference a variable instead of adding directly a value, at that time SailPoint is renaming the variables accordingly. For example in this case, I have added $.defineVariable.o as a String value.

In this case there is no .$ in the key name. Check out VariableB

But then why is one of the loops adding a .$ at the end of variableB

So whenever, you comparing through variables, like $defineVariable.q, it will ADD .$ .

Whenever, you compare the value directly. It will NOT ADD the .$ .

I am trying to mimic your workflow though. Will let you know if I find the issue.