Multiple custom field update()

#1

Hi,
i am wondering how update a multiple custom field.

The doc at this

url

works with mutipe fields just replacing an option with another, but not adding options towhat already existing.

Thanks from any help

#2

Hi Violaine,
this should help.

You can add an option to an existing multiple option custom fields with a simple PUT request.

Step 1
Make a GET request to /dealFields. You’ll see in your custom field the current list of options, which will look like this:

"id": 123,
"key": "911cf1156cbfe124c760571836c41d0446de538c",
"name": "My Multiple Option Field",
"order_nr": 1,
"field_type": "set",
...
"options": [
    {
        "id": 9,
        "label": "Red"
    },
    {
        "id": 10,
        "label": "Green"
    },
    {
        "id": 11,
        "label": "Brown"
    },
    {
        "id": 12,
        "label": "Yellow"
    }
]

If you want to add the option orange, you can make a PUT request to /dealFields/id (in this case 123) with the options parameter set to:

"options": [
    {
        "id": 9,
        "label": "Red"
    },
    {
        "id": 10,
        "label": "Green"
    },
    {
        "id": 11,
        "label": "Brown"
    },
    {
        "id": 12,
        "label": "Yellow"
    },
    {
        "label": "Orange"
    }
]

You can see that I passed the same array plus the new option without specifying the id.

I hope that helps :slight_smile: