Working with loops and JSON

Hi there! I’m new to automation in general and I started working just las week with Activepieces. I’m having a problem with my Loop step.


This is my flow. I get won opportunities from Salesforce in the form of a JSON with many levels, I them flatten this JSON and the pass this to the Loop step.

image
The Loop is receiving a list of 2 items.


But the output only shows the first item and the iterations object is empty. When I test the next step which is a inser row in Sheets only one row is written, the first item of the list.

Your loop step, what have you added as the input?

Here is an example I have:

In my json I have Students with 8 items (8 “StudentInformation” items).

In my Loop, I loop on Students:

The test output only shows one, but in the run it loops on all items.

What are you looping on? Or are you seeing that it only brings in limited data on the PIECE test? Or did you notice it only loops on a few items during a FLOW test?

My input for the loop is this. In this case I have a list with 2 items inside.
image

Edit: I noticed that you said at the end that the test always shows only 1 item, but in the live run you say that it works fine. I will try that now.

Right, I managed to make the flow work, but it’s writing the first item of the list twice, even though it got the 2 items correctly as input.

Brother, on the loop step, get a screen grab like this:

I wonder if you’re “looping” on first item in the list instead of the the 2 items within the json payload.

In my screenshot, I am looping on Students (which holds the items), where as the Student Infromation is just 1 list item.

It was in fact this the mistake I was making! I was passing the wrong step to the loop. Thank you for your help!

VICTORY!

Don’t forget to close this with a solution.

For future reference: better screenshots! Blur and censor, but providing more information at the outset is helpful.

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