Best answer

Find Or Create Records Logic


Userlevel 1

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.

icon

Best answer by GetUWired 14 May 2021, 15:25

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

2 replies

Userlevel 7
Badge +9

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

Userlevel 1

Amazing, thank you very much for your help.

Reply