Custom fields filter does not work in searching tasks in a workspace

I’m including opts['custom_fields.123.is_set'] = True to my request to get only those tasks, that have this field filled in.
However, I get all tasks, including those that don’t have this field filled in or those that don’t even have this field at all.
I have tried using both the Python asana library and the requests module and the result is the same.
This field is global and should be in the library, as it has “is_global_to_workspace”: True
It looks like a bug and I can’t seem to find a solution/workaround to this.
Any suggestions will be appreciated.

The code where I use Asana Python library is basically the same as in the documentation:

configuration = asana.Configuration()
configuration.access_token = token
self.api_client = asana.ApiClient(configuration)
tasks_api_instance = asana.TasksApi(self.api_client)
api_response = tasks_api_instance.search_tasks_for_workspace(workspace_gid, opts)

and opts are
{'custom_fields.field_gid.is_set': 'true' (or True, I tried both), 'projects.any': 'project_id', 'opt_fields': 'gid,modified_at'}

it should be the direct boolean, not a string between quotes. Are you sure you tried it without quotes?

Yes, it was my first option to go
Here is my opts in the runtime:

Here is a task with this field filled

And here is one without value

This is happening on the same run
(I’m not sure if I should hide field gid, so I just did it to be extra-safe)

Hi @Dmytro_Horodetskyi,

I’ve not been able to reproduce this behavior. Can you test with curl or Postman a GET request with the following syntax?


Hey @David_Neal!

I tried your syntax, but the response included tasks, which did not have this custom field, so I hope it is okay for me to add “project.any={project_id}” to the link

So here is the code

And, unfortunately, I still got tasks without this custom field filled.

What type of custom field is this “Task type?”

It has multi_enum type
Both multi_enum_values and display_value in response are None for some tasks

Ah, I believe that is the issue. If you look in the API docs, it reads:

Not Supported : searching for multiple exact matches of a custom field, searching for multi-enum custom field

I believe this also applies to using the is_set filter. I’ve tested with a multi-enum and I’m seeing the same behavior. I will confirm with the API team, but I believe this expected behavior for this type of custom field.


I believe the workaround would be to include opt_fields=name,modified_at,custom_fields.display_value and filter out all tasks in your code that have a display_value: null for the custom field gid you are targeting.


@David_Neal Ah, I somehow missed that second part in the documentation…
Can confirm that this functionality works with enum fields, so we will probably switch to them or use your suggested workaround.
Thank you for your time and effort!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.