update: multi-select

Because there is not much information available about the custom field update by api.
The only i could do is to suspect an abstracted api solution.

using the “GET /projects/:project_gid/tasks”
this is the response I have … for “enum_options” and “multi_enum_values”


{
“data”: [
{
“gid”: “1201142848114842”,
“custom_fields”: [
{
“gid”: “1201451718124486”,
“enum_options”: [
{
“gid”: “1111111111111111”,
“name”: “9001:2015”,
},
{
“gid”: “2222222222222222”,
“name”: “27001:2013”,
},
{
“gid”: “3333333333333333”,
“name”: “14001:2016”,
},
{
“gid”: “4444444444444444”,
“name”: “22301:2019”,
},
{
“gid”: “5555555555555555”,
“name”: “45001:2018”,
}
],

      "multi_enum_values": [
        {
          "gid": "1111111111111111",
          "name": "9001:2015",
        },
        {
          "gid": "2222222222222222",
          "name": "27001:2013",
        },
        {
          "gid": "5555555555555555",
          "name": "45001:2018",
        }
      ],

      "name": "ISO",
      },

      "display_value": "9001:2015, 27001:2013, 45001:2018",
      "resource_subtype": "multi_enum",
      "resource_type": "custom_field",
      "type": "multi_enum"
    },

Now i want to change the multi-select
from … “display_value”: “9001:2015, 27001:2013, 45001:2018”
to … “display_value”: “14001:2016, 22301:2019”


using the follow:

“PUT”
https://app.asana.com/api/1.0/tasks/9999999999999999

{
“data”: {
“custom_fields”: {
“1201451718124486”: “3333333333333333”
}
}
}

but somehow needs to pass an array for setting a multi-select custom field
and seems i’m not enough smart, how to do it!
so i need a little HELP.

Thank you!

I haven’t tried it yet, but try adding square brackets:

{
    “data”: {
        “custom_fields”: {
            “1201451718124486”: [“3333333333333333”]
        }
    }
}
3 Likes

Indeed it works this way for “multi_enum” (multi-selector custom field).
Just inside the brackets we type all the “enum_options” id’s.

{
“data”: {
“custom_fields”: {
“1201451718124486”:[“1201451720171180”,“1201451720171167”,“1201451720171188”]
}
}
}

Thank you Phil !

1 Like