Updating AllowedValues in a dropdown contact field, erases any existing data for the contact field
I've documented the issue pretty well on another community: https://community.make.com/t/using-the-wildapricot-update-contactfields-api-call-to-update-pick-list-erases-data/26286?u=alex.newpath
I thought this may have been a Make issue, but I validated this in Postman:
- Using the /accounts/{accountId}/contactfields/{contactFieldId} endpoint, I assume that when updating a dropdown list I can ADD new picklist values to the existing picklist.
- In reality the AllowedValues array I sent in a PUT to this endpoint REPLACES the existing fields and reassigns the IDs and Values for any existing picklist item in the dropdown and assigns new IDs and new values for new picklist items added in the call.
- Any contact data that has used this dropdown field has its data erased in the contacts because the underlying ID and Value has been changed for every picklist item.
I think this is a bug in the API because the expected behavior is to be able to add new allowed values which is possible, but if the same Name as an existing picklist item is submitted the API should not erase the existing picklist item but rather keep the ID and Value the same as before.
I would expect any fields not submitted in AllowedValues array to be therefore erased from the contact field's definition. This part works as designed.
This is, after all, how the Contact Fields User Interface works when I add or remove fields.
Here's the body of the PUT I am sending as an example. Note if I keep the old IDs and Values in the AllowedValues array they are disregarded and not used in the PUT.
{
"FieldName": "testing-changes-viaAPI",
"IsRequired": false,
"AdminOnly": false,
"Access": "Public",
"FieldInstructions": "",
"Order": 1,
"FieldType": "Dropdown",
"Type": "Choice",
"AllowedValues": [
{
"Label": "item5",
"Value": ""
},
{
"Label": "item6",
"Value": ""
},
{
"Label": "item1",
"Value": ""
},
{
"Label": "item2",
"Value": ""
}
],
"Id": 15981674
}
Hello!
This issue has been fixed in the new release (8.7).