Searching custom fields from API (Zapier)


#1

I am using Asana as a mini-crm and have a custom field for email, address etc. I use Zapier to sync records from QBO and Eventbrite to track interactions with customers etc. Is their any way to lookup the record (task) by searching the email custom field instead of searching the task name which is not unique?


#2

Hi @Yossi_Goldblatt,

This is possible (though admittedly gnarly) using the Asana API. You would need to write a script that first gets all of the tasks you wish to search. To get the list of tasks, you need to specify a project or tag, or assignee and workspace in your query. You can check out the docs to get more details on querying for tasks.

Once you get all of the task_ids of the tasks you wish to search, you would need to make a get request for each task.

Here is a sample response from GET /tasks/1001

# Response
{
  "data": {
    "id": 1001,
    "name": "Hello, world!",
    "completed": false,
    "...": "...",
    "custom_fields": [
      {
        "id": 124578,
        "name": "Priority",
        "type": "enum",
        "enum_value": {
          "id": 439,
          "name": "High",
          "enabled": true,
          "color": "red"
        }
      },
      "~..."
    ]
  }
}

As you can see above, the response contains a custom_fields array that you would need to check to see if it contains the value (i.e. the email address) for which you are searching.

We hope to add search functionality to the API in the future, which would make searching for a specific custom field value a lot easier.