When you Subscriber.AddWithCustomFields the data is required to be formatted like so. It makes perfect sense in that DataType MultiSelectMany is natively an array of values. So `foods` value must be an array. Perfect sense.
Array (  => Array ( [Key] => synced [Value] => 20090920040251 )  => Array ( [Key] => Birthday [Value] => yes )  => Array ( [Key] => foods [Value] => Array (  => Broccoli  => Chocolate ) ) )
So why does Subscribers.GetSingleSubscriber not return the data in the same way?
Array (  => Array ( [Key] => synced [Value] => 20090920040251 )  => Array ( [Key] => Birthday [Value] => yes )  => Array ( [Key] => foods [Value] => Broccoli )  => Array ( [Key] => foods [Value] => Chocolate ) )
This makes it much much harder to check values using Subscribers.GetSingleSubscriber prior to trying to update using subscriberAddWithCustomFields as per today's response from CM staff about subscriberAddWithCustomFields clobbering existing custom field values:
"Yes, you need to specify the existing custom field values when updating a subscriber with subscriberAddWithCustomFields, otherwise the original values will be cleared. If you need to you can get the existing values using getSingleSubscriber."
Why why why would you pass the data back out in a format different from the way it goes in and in such an un-helpful way.
Now before I can organize the data I get from GetSingleSubscriber I am going to have to query List.GetCustomFields and look for ['ListCustomField']['DataType'] == 'MultiSelectMany' to find out that the field's value(s) should be stored in an array and not a string.
This is making me lose my mind.
From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that drive real business results.Get started for free