Update multi option select

Hi Folks

I was wondering if there was a way to update a multi option select without clearing out the curretly selected options. I am able to unselect a specific item using the clear flag but when I try to select another option it clears all of the options that were previously selected. I would like the field to retain the currently selected options when I select another option to add. I'm using the PHP wrapper for the api.


ChrisB ChrisB, 3 years ago

Hi Mercatus!

Are you running your update with the Clear parameter set to true? If so, that would be the issue. The Update Subscriber details describe what happens to values for a multi-option custom field that are not included in the array:

"Any missing values will remain unchanged. Multi-Valued Select Many custom fields are set by providing multiple Custom Field array items with the same key."

See that here: http://www.campaignmonitor.com/api/subscribers/#updating_a_subscriber. And feel free to post your code here as well!

Mercatus, 3 years ago

Hi Chris

Thanks for the response. No, I am not running my update with the clear parameter set to true. Heres a snippet of the json I am using for the field update -

a:2:{i:0;a:3:{s:3:"Key";s:9:"Interests";s:5:"Value";s:10:"E-Circular";s:5:"Clear";b:0;}i:1;a:2:{s:3:"Key";s:5:"diff_key";s:5:"Value";s:42:"some text here";}}

So according to the documentation, this should add the "E-Circular" option to the Interests field without clearing the currently selected options but it seems to be clearing them out.

Any thoughts?

Mercatus, 3 years ago

I've tried this with php wrapper v3.1 pointing to api v3 and wrapper v4.0 pointing to api v3.1 and had no luck.

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free