I'm hoping someone can shed some light on a problem I'm having.
I want to use the multi option field for a client however I am not sure how to integrate it into the API - I've searched the website and forum but I cannot see any info on this type of field.
I have created an array from the checkboxes in my form and I can import it as a comma separated text value in the db. However when I try and work with the Multi-Option field type itdoes not get picked up.
How do the keys work with Multi option fields?
Any advice would be greatly recieved.
Firstly my apologies it has taken so long for someone to get back to you.
The keys for multi-option custom fields are either the Custom Field name itself, or the personalization tag for the field, minus the fallback part. Either should work. If you continue to have trouble, please feel free to send in a support request outlining what you are doing, any code you are using, and where the trouble is. Hope this helps.
I am having the same issue.
For me the keys are not the problem, but how to format the values.
This is the body of my request:
<Subscriber.AddWithCustomFields xmlns="http://app.campaignmonitor.com/api/"> <ApiKey>....</ApiKey> <ListID>...</ListID> <Email>...</Email> <Name>...</Name> <CustomFields> <SubscriberCustomField> <Key>JobTitle</Key> <Value>Production Director</Value> </SubscriberCustomField> <SubscriberCustomField> <Key>Company</Key> <Value>Some Company</Value> </SubscriberCustomField> <SubscriberCustomField> <Key>Agreetoterms</Key> <Value>57294</Value> </SubscriberCustomField> </CustomFields> </Subscriber.AddWithCustomFields>
The fault string in the error I am getting is:
System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (6, 52). ---> System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Xml.XmlConvert.ToInt32(String s) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read14_SubscriberAddWithCustomFields() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() --- End of inner exception stack trace --- at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
"Agreetoterms" is a multi option field which has a single option. The numbers are the value CM assigned in the form that was generated.
My best guess is that the error message is coming up because I have incorrectly formatted the value for this custom field, but I do not see any documentation indicating the correct format. I have found a few other forum questions where people are asking the same thing (as the poster above), but none seems to contain a conclusive answer or example as to how this data should be formatted for the API.
Thanks for any assistance you can provide!
Actually a bit more debugging solved my problem (it was not related to multi-options at all, that was a red herring).
I was using a PHP library (http://code.google.com/p/campaignmonitor-php/) which had not been updated with the new createsend.com API URLs. It took me a few passes to ferret out where those URLs needed to be changed. Once I made this update it worked find.
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