cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to iterate through array of string inside repeat for each loop

samarth_nigam
Deputy Chef I
Deputy Chef I

Hello,

The payload I am getting as a response is - 

 

{
Message: "<div class="zd-comment" dir="auto"><span style="opacity: 1;"><img src="https://cybergrants1720708638.zendesk.com/attachments/token/TbvvjGtyhrIe3xX29VG3gQtQT/?name=image.png"><img src="https://cybergrants1720708638.zendesk.com/attachments/token/Ch1NuHKgwfEDSLKF4C3wWGaSh/?name=image.png"></span><br></div>"
}

 

I extracted all the HTTPs urls from the above payload and stored them in a string variable 'attachment_ur_ls'. I printed the variable value and it is showing - 

 

{
	"attachment_ur_ls": [
		"https://cybergrants1720708638.zendesk.com/attachments/token/TbvvjGtyhrIe3xX29VG3gQtQT/?name=image.png",
		"https://cybergrants1720708638.zendesk.com/attachments/token/Ch1NuHKgwfEDSLKF4C3wWGaSh/?name=image.png"
	]
}

 

Now I want to iterate through each of the link present in the above variable. I used a Repeat for each but unable to select the above variable inside Input list field. 

The attachment_ur_ls looks like an array of string, and I want to iterate through each link present inside the variable and take actions accordingly.

Please help me in fixing this, it's on priority!

1 REPLY 1

timwolfe
Deputy Chef II
Deputy Chef II

No Response so I will take a shot at it:

To fix this:

1. Make sure `attachment_ur_ls` is an actual array and not a string. If it's a string, parse it first (e.g., `JSON.parse()`).
2. Pass the variable `attachment_ur_ls` directly into the "Repeat for each" loop.
3. Test with a dummy array like `["url1", "url2"]` to ensure the loop works.

If this still doesn’t work, check if the variable is properly scoped or formatted for the loop to recognize it.