Hi @Andy_Pilipovic,
Glad you figure this out. For the folks who stumble across this post, you can access the gid of the selected enum values for a multi-select enum custom field by asking for the custom_fields.multi_enum_values in the opt_fields query params.
Context:
custom_fields.multi_enum_values → if your custom field is a multi_enum type (i.e., 'resource_subtype': 'multi_enum') this contains information about the enum_values that was selected.
custom_fields.display_value → regardless of custom_field type this will return the text value of that custom field
custom_fields.enum_options → if your custom field is a multi_enum type (i.e., 'resource_subtype': 'multi_enum') this will return the available enum options for that multi-select custom field.
Here’s what the usage might look like for the python client (v3.2.2):
import asana
from pprint import pprint
client = asana.Client.access_token("<YOUR_PERSONAL_ACCESS_TOKEN>")
task_gid = "<YOUR_TASK_GID>"
result = client.tasks.get_task(task_gid, fields="custom_fields.name,custom_fields.display_value,custom_fields.multi_enum_values,custom_fields.enum_options")
pprint(result)
This is an example response from the code above:
{'custom_fields': [{'display_value': 'Option 1',
'enum_options': [{'color': 'green',
'enabled': True,
'gid': '<ENUM_OPTION_1_GID>',
'name': 'Option 1',
'resource_type': 'enum_option'},
{'color': 'red',
'enabled': True,
'gid': '<ENUM_OPTION_2_GID>',
'name': 'Option 2',
'resource_type': 'enum_option'}],
'gid': '<CUSTOM_FIELD_GID>',
'multi_enum_values': [{'color': 'green',
'enabled': True,
'gid': '<ENUM_OPTION_1_GID>',
'name': 'Option 1',
'resource_type': 'enum_option'}],
'name': 'Multi-Select'}],
'gid': '<TASK_GID>'}
Notice that multi_enum_values has extra information for the value in the display_value and notice that enum_options returns the available enum_options for this specific multi-select custom field.
You can apply this opt_fields trick with Get multiple tasks endpoint as well.
EX:
import asana
from pprint import pprint
client = asana.Client.access_token("<YOUR_PERSONAL_ACCESS_TOKEN>")
project_gid = "<YOUR_PROJECT_GID>"
result = client.tasks.get_tasks({"project": [project_gid]}, fields="custom_fields.name,custom_fields.display_value,custom_fields.multi_enum_values,custom_fields.enum_options")
pprint(list(result))
TIP: Look at the full schema of the resource that is being returned to understand what values you can request for in the opt_fields EX: if you are making calls to Get multiple tasks, Get a task you can look at the full task schema and read about the properties that is available.
Another trick is to look at the listed options in opt_fields drop down for those endpoints.
EX: