Search tasks in a workspace

I am using the API - Search tasks in a workspace to get the list of tasks under a project. I have a custom multi enum field on which I am trying to filter but the documentation doesn’t mention how to pass value of a multi enum in the params. I tried using

tcustom_fields.{gid}.value

bu it didn’t work.

How can I filter on a multi enum field?

Good question! I wonder if the search functionality hasn’t been updated yet to support multi_enum fields (which are relatively new)?

@AndrewWong can you help here?

2 Likes

Hi @Support5, @Phil_Seeman is correct. We currently do not support searching of multi_enum custom fields for our Search tasks in a workspace (GET /workspaces/{workspace_gid}/tasks/search) endpoint. Thank you for bringing this up. We have updated our documentation to note that this is currently not supported under the Custom field parameters table (the table in your screenshot) in " Not Supported".

We still need to spec the behavior out (i.e. if a developer specifies custom_fields.<multi_enum_custom_field_id>.value=<option 1>,<option 2> does this mean return only tasks that have option 1 and option 2 or return all tasks that have either one set?).

@Support5 and @Phil_Seeman if you have any inputs on the behavior for searching with multi_enum custom fields let us know and we can bring this up to our API team.

1 Like

Any progress on this?

The Asana client can perform advanced filters on Custom Enum fields where a task can have “any of the checked values set” and the correct results are returned.

We still need to spec the behavior out (i.e. if a developer specifies custom_fields.<multi_enum_custom_field_id>.value=<option 1>,<option 2> does this mean return only tasks that have option 1 and option 2 or return all tasks that have either one set?).

@John_Vu - to answer your question, the Asana client uses a tilde (“~”) to separate the “OR” values and it seems to work. I don’t understand why these parameters don’t translate to the API.

The following real query (with redactions “xx”) returns all tasks with a custom field “ABC” is set to (“Open” OR “In Progress” OR “Completed”) AND (field “XYZ” has “any value”)

https://app.asana.com/0/search?sort=project&custom_field_120616xx83084.variant=is&custom_field_120616xx83084.selected_options=1206167xx83085~120616xx83086~120616xx83087&custom_field_120616xx474867.variant=any_value

How do I get this to work with the /workspaces/WORKSPACE_GID/tasks/search API?

Hey Joehanna!
Thank you for reaching out to Peoplebox. Please allow me some time to check this for you.

Hi @joehanna,

Thank you for pointing out the behavior of the Asana client multi-enum search. I’ll make a note of this for our API team.

To answer your question as to why copying the query params from the Asana web client URL and using that query in Search tasks in a workspace does not work → This is because the Asana web client is not built using the Asana API.

I spoke with our API team and we currently do not support filtering for multi-enum values via our API for our Search tasks in a workspace endpoint.

Thanks for your follow up @John_Vu. This is disappointing, as the behaviours across touch points (client, API etc) are inconsistent. The bottom line now means issuing multiple API calls, one for each enum value (3x as many in the example of above), which will be complicated by rate limiting.

@Support5 and @Phil_Seeman if you have any inputs on the behavior for searching with multi_enum custom fields let us know and we can bring this up to our API team.

What was the outcome from discussions with the API team other than it is not supported? Is this slated to be fixed/implemented?

Thanks

Hi @joehanna,

I can see why this can get complicated. I checked in with our API team and it looks like they are treating this as a feature request. They could not provide me a timeline of when this would be implemented.

Thanks @John_Vu. Never mind. We all know how Asana’s feature requests timelines turn out. Asana’s FOMO with the AI hype has their developers building those cool things that no-one asked for, meanwhile, your daily users are screaming for basic changes that cause grief every single day. Some of which were requested over 6 or more years ago.

@joehanna Just as an FYI, the Asana API team of developers is completely independent of the AI (and other) development teams. I happen to know that the API team is working on other API-related changes, not on anything AI-related.