Question

Search by several parameters


Hi,

I am trying to create an API request, with a search action meant to search for a contact. I want to be able to run the seach with multiple search terms in different fields, and if one of them matches the query returns that contact. For example searching by:

Name
OR
E-mail address
OR
Business registration number

The way I have set it up now, it seems like all fields entered are required to match in order to return a result. So for example if it searches for the correct business reg. no., but the seach also includes an outdated e-mail address - the search fails. 

Is there a way to fix this through the API request? Or must the user set up path rules in the zap in order to achieve this? 

This is the API request as of now:

 params: {
'name': bundle.inputData.name,
'email': bundle.inputData.email,
'organizationNumber': bundle.inputData.organizationNumber,
'supplierNumber': bundle.inputData.supplierNumber,
'customerNumber': bundle.inputData.customerNumber,
'memberNumber': bundle.inputData.memberNumber,
'customer': bundle.inputData.customer,
'supplier': bundle.inputData.supplier,
'inactive': bundle.inputData.inactive,
'group': bundle.inputData.group
}
}

return z.request(options)
.then((response) => {
response.throwForStatus();
const results = response.json;

// You can do any parsing you need for results here before returning them

return results;
});

Many thanks!


0 replies

Be the first to reply!

Reply