Skip to main content
Question

Zapier to Loop Only Unique Values

  • December 22, 2025
  • 2 replies
  • 5 views

Hello all,

I am trying to achieve the following - lets say I have a Sales Order.

Sales Order contains 5 products, from 3 vendors.

 

Product 1 - Vendor A

Product 2 - Vendor A

Product 3 - Vendor B

Product 4 - Vendor C

Product 5 - Vendor C

 

What I want is the following - one Zap started via a webhook which creates total of 3 Purchase Orders

PO 1 - Vendor A

Product 1

Product 2

 

PO 2 - Vendor B

Product 3

 

PO 3 - Vendor C

Product 4

Product 5

 

The problem is that 

  1. I need to loop the vendors in the product line items in the SO, but only take unique values
  2. Then for each value I need to loop through the line items but pick only the ones that are related to a vendor

 

I tried the AI in Zapier, but he was working for over two hours back and forth and he did not provide any results.

 

Any advice or ideas are most appreciated and welcome.

 

Thank you

2 replies

Sparsh from Automation Jinn
Forum|alt.badge.img+6

Hey ​@IvanStaykov,

For advanced looping to take into account only unique values and nested loops, you can use Code by Zapier action. See more about it here- https://help.zapier.com/hc/en-us/articles/8496310939021-Use-JavaScript-code-in-Zaps. Hope it helps!

 


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • December 22, 2025

Hi ​@IvanStaykov 

The solution will involve custom code to sort and create matched sets to loop thru.

https://zapier.com/apps/code/integrations#help

 

You can try asking ChatGPT for help with the Code. (JavaScript / Python)

 

If you need to hire help, there is a directory of Zapier Partners: https://zapier.com/partnerdirectory