How to start for each loop from second record in flow designer

shweta14
Tera Contributor

How to start for each loop from second record in flow designer

On catalog item having list type variable which contains records
want to start for each loop from second record from that list.

 

how to do this?

2 REPLIES 2

Sohail Khilji
Kilo Patron

Hi @shweta14 ,

 

Here is the logic.

 

1. Move the list to an array variable.

2. Remove the 1st element which is [0]th element from the array.

3. now apply for each. by doing so your applying foreach by removing 1st element. (may be you can create an action for removing 1st element,)

 

example code :

let myArray = [1, 2, 3, 4, 5];
myArray.shift(); // removes the first element, which is 1
console.log(myArray); // output: [2, 3, 4, 5]

 

I hope this helps...


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi Sohail,

Is there any other way to remove first element or start with second element without custom action creation.