Empty enum_value and multi_enum_values in Python client

I’m working on querying the Asana API using the Python client. I’m specifically trying to access some custom field values on a project’s tasks. There are two sets of custom fields on this object - one that’s a single-select, and one that’s a multi-select.

First, I query by task id:

task_example = client.tasks.find_by_id(<task_id>)

I get back the task, and start trying to dive into the custom fields. I can see the enum_value key exists (and have confirmed it’s populated on the task in question)… and yet the enum_value is None!

task_example[‘custom_fields’][1].keys()
dict_keys([‘gid’, ‘enabled’, ‘enum_options’, ‘enum_value’, ‘name’, ‘description’, ‘created_by’, ‘display_value’, ‘resource_subtype’, ‘resource_type’, ‘type’])

print(task_example[‘custom_fields’][1][‘enum_value’])
None

I’m hitting the same problem when I try to look at the value of multi_enum_values.

What the heck? Everything I’ve read in the docs implies that this is where I should be seeing these values, but I just don’t. Is it permissions/account related? Is the Python API client broken? Anyone had any similar experiences?

Hi @Owen_Henry,

I’m not familiar with the Python client specifically, but I think you’ll need to use the opt_fields parameter to get the task’s custom field details, kind of as shown here:

In that example they’re getting the display_value; you’ll need to specify the enum_value and multi_enum_values instead.

1 Like

That was it, thank you!

1 Like