Help ! Custom Function : Searching Client Company
I'm trying to run a custom function in Zoho Flow that looks up a Client Company using the Client Name. I want it to return only the matching record or an error; at the moment it's defaulting to the first reponse (I think)
Can someone help tweak this function as I feel I'm very close :
- string ZP_getClientID(string varClientName)
- {
- payload = Map();
- payload.put("name",varClientName);
- response = invokeurl
- [
- url :"https://projectsapi.zoho.eu/restapi/portal/XXXXXXXXX/clients/"
- type :GET
- parameters:payload
- connection:"devteam_zoho_projects"
- ];
- //Change the response to a map to extract specific information
- responseMap = response.toMap();
- for each varRecord in responseMap
- {
- //Something here
- }
- varFoundID = responseMap.get("clients").getJSON("id");
- return varRecord;
- }