cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Reference the current item in a repeat loop

Waldy
Deputy Chef III
Deputy Chef III

For some reason I just cannot get the current item from a repeat loop.  In the job history, you can see a data pill called Item with the content that I want to extract, but I just cannot refer to that in an action within the loop.

1 ACCEPTED SOLUTION

Waldy
Deputy Chef III
Deputy Chef III

I create a variable, set it as a List type.  I then update the variable and set the contents from a split string:

Screenshot 2026-07-13 091229.png

In the For Each I reference the List variable:

Screenshot 2026-07-13 091433.png

Then I try to reference the current item in the loop branch:

Screenshot 2026-07-13 091831.png

But there is no data pill to reference.

I got there in the end.  I had to use the List variable with the Index data pill:

Screenshot 2026-07-13 092053.png

View solution in original post

4 REPLIES 4

Waldy
Deputy Chef III
Deputy Chef III

Within the loop branch action, I can only see Index, Size, Is first and Is last data pills

The Foreach output looks like this in the job history:

{
Index: 0,
Is first: true,
Is last: false,
Item:
{
value: CN=o365_Office365_E5,OU=Office 365 Licensing,OU=Groups,OU=Common,OU=Enterprise,OU=xxx,DC=xxx,DC=xxx
}
}

 

rharkness
Deputy Chef I
Deputy Chef I

What are you using as you input list when defining the For Each Repeat?  Because when I use a data pill that is a list object, I can see this when I am trying to select an item from the current data item in the loop.  Step 22 represents the For Each Loop and those are all the data pills from inside that item I can selectimage.png

Waldy
Deputy Chef III
Deputy Chef III

I create a variable, set it as a List type.  I then update the variable and set the contents from a split string:

Screenshot 2026-07-13 091229.png

In the For Each I reference the List variable:

Screenshot 2026-07-13 091433.png

Then I try to reference the current item in the loop branch:

Screenshot 2026-07-13 091831.png

But there is no data pill to reference.

I got there in the end.  I had to use the List variable with the Index data pill:

Screenshot 2026-07-13 092053.png

Sorry I'm late to the party, but as you discovered the for each loop doesn't handle primitive arrays very well. That way you solved it is probably the most efficient way in terms of task usage.