Setting multiple values in multi_enum custom fields

I’m attempting to create tasks via the /tasks endpoint and want to set multiple values in a custom multi_enum field.

The tasks endpoint accepts a custom_fields object, which only allows me to set a single value per custom field.

"custom_fields": {
    "123456": "Apples"

This is great, except when the custom field identified by 123456 is a multi_enum field for which I’d like to set multiple values. Objects cannot have duplicate keys, so it seems like you’re only able to set a single value.

I have tried to do the following, which results in an error:

"custom_fields": {
    "123456": ["Apples", "Oranges"]

Hi @helrond and welcome to the forum,

Multi-enum fields are very new; I haven’t tried to set them on a task yet myself, not 100% sure that’s supported yet in the API but I think it probably is.

In your example it looks like “Apples” and “Oranges” are text values for enum entries. You need to supply the enum gids for these, not their text values - that could well be your problem.

If that’s not the answer, then please show the exact error message you’re getting.

1 Like

I was actually passing gids but I think the issue may have been that I was passing those as integers rather than strings, which is totally my bad.

I just tried:

"custom_fields": {"123456": ["123457", "123458"]}

and am getting the expected results in the UI.

Wondering if the API docs might need to be updated? According to the API docs, custom_fields is

An object where each key is a Custom Field gid and each value is an enum gid, string, or number.

The above case (a list of enum gids) does not seem to be covered.\


Perfect! Yes, definitely need strings. A few years back, gids were numeric, but they changed them to strings at one point.

Calling @AndrewWong :slight_smile:

1 Like