Skip to main content
Best answer

Find Or Create Records Logic


Hi,

 

we’re developing a custom integration for Zapier which implements a Find or Create User action with few fields ( name, email, field1 ).

Depending on the used fields, our REST API endpoint will return one or more results, but it seems that Zapier will always take only the first item from the result set. I wasn’t able to find more information about this, is it meant to be always only one result or is there a way to iterate over all results?

For example if I search by field=”test” I’ll get 10 Members and now I thought that I could use these 10 members for my next action, but it’s using always only the first item.

Best answer by GetUWired

Hi @Daniel_F 

You will need to manipulate the response if you want to return all persons found. By default when you return the array of objects, Zapier only outputs the first object. They do this because Zapier tends to work 1:1. Not many actions accept multiple inputs. 

If you always want to return all results, the fastest way would just be to return [{all_results: results}]

Though forcing this type of return would also mean you need to check if results exist before returning, since you are trying to implement a Find/Create action

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

GetUWired
Forum|alt.badge.img+12
  • Zapier Expert
  • 1030 replies
  • Answer
  • May 14, 2021

Hi @Daniel_F 

You will need to manipulate the response if you want to return all persons found. By default when you return the array of objects, Zapier only outputs the first object. They do this because Zapier tends to work 1:1. Not many actions accept multiple inputs. 

If you always want to return all results, the fastest way would just be to return [{all_results: results}]

Though forcing this type of return would also mean you need to check if results exist before returning, since you are trying to implement a Find/Create action


  • Author
  • Beginner
  • 1 reply
  • May 14, 2021

Amazing, thank you very much for your help.