How to get all custom field values for a specific task using the api

Hi,

How to get all values of a custom field including multi-value custom fields of a task using the api?
eg. if i have 2 columns with custom fields and both have multiple values in them, then how do i know what field options was selected for that specific task using the api?

Thank you

i tried this -
https://app.asana.com/api/1.0/projects/{pid}/tasks?opt_expand=custom_fields

but it doesnt arrange it in showing the task name and what custom field values it has

I just tried and it works well, using opt_expand or opt_fields =“custom_fields” as you do.

In the response, I see the custom_fields array of each task, and, inside it, for a custom fields of type “multi_enum”, I get multi_enum_values collection of each selected items.

Each type of custom fields have its own property, like text_value, number_value, etc.

Thank you for advising, maybe i am missing how to read it correctly as there is too much noise in the response.
eg. if i use tags it will give me an array of specific names of the tags for that specific task:
https://app.asana.com/api/1.0/projects/{pid}/tasks?opt_expand=tags

However when using custom fields it has a long list of all the custom fields but not showing the custom field belongs to a task in the way tags do it.

eg output of tags:
“data”: [
{
“gid”: “123”,
“name”: "task name ",
“resource_type”: “task”,
“tags”: ,
“resource_subtype”: “default_task”
},

custom_fields output:
“data”: [
{
“gid”: “34256”,
“custom_fields”: [
{
“gid”: “2345”,
“enabled”: true,
“enum_options”: [
{
“gid”: “4357546”,
“color”: “green”,
“enabled”: true,
“name”: “num1”,
“resource_type”: “enum_option”
},
{
“gid”: “25436”,
“color”: “red”,
“enabled”: true,
“name”: “num2”,
“resource_type”: “enum_option”
},
{
“gid”: “25437645”,
“color”: “blue”,
“enabled”: true,
“name”: “num3”,
“resource_type”: “enum_option”
},
{
“gid”: “2435654”,
“color”: “hot-pink”,
“enabled”: true,
“name”: “num4”,
“resource_type”: “enum_option”
},

so it doesnt group the num4,num1 belongs to task x

https://app.asana.com/api/1.0/projects/{pid}/tasks?opt_fields=name, custom_fields.multi_enum_values.name

The above works if anyone else needs the same but would be better if it was more streamlined like the tags

2 Likes