Hi, I'm working with a SubscriberDetail object, which allows me to add to the CustomFields collection, but how then do I send the updated info back to the web service?
eg. I create the new custom field as follows:
Dim oField as New createsend_dotnet.SubscriberCustomField oField.Key = "myfieldname" oField.Value = "fieldvalue" mySubscriberDetail.CustomFields.Add(oField)
How do I now send that object to the web service, so that the new custom field is actually added?
Similarly, if I just change the value of a field, how do I send that change to the web service?
We actually have a sample for something like this. You can see the general idea if you take a look at this page. This code is in C#, but should be very easy to translate to VB. Basically, you'll need to create a new createsend_dotnet.Subscriber object and call either Update or Add on that new createsend_dotnet.Subscriber object.
Let me know if you need further assistance!
Many thanks Terry.
Sorry but I'm still unsure how the update works exactly. It looks like I create a new subscriber object and the Update method tells it which *existing* record to update (by email address). So, questions:
1. If I don't want to change the email address, the second email parameter should be null/nothing?
2. If I only want to add 1 custom field, or if I just want to change the value of a single existing custom field, do I just pass that change as a list item, or do I need to pass the *entire* list of custom fields? (ie. does the API work out what to update, or does it replace the entire list with what is provided?)
3. How do I delete a custom field?
1. You can just pass the email address again, even if you aren't changing it.
2. You have to pass the entire list of custom fields. This way the system knows what to add and remove based upon what the list looks like.
3. This is the same as #2. You'll need to pass in the entire list of custom fields so the system knows what needs to be removed.
Let me know if you need anything futher!
Thanks for your help Terry, much appreciated.
I'm now able to add & update subscriber custom fields which are simple strings. But not sure how to add/update a subscriber custom field which must specify more than one option of a "multiple option (select many)" field type?
In other words, what do I provide to the Value property of the SubscriberCustomField object to specify more than one option?
For example, if my multi-choice custom field options are "Red", "Green" and "Blue", how do I create a SubscriberCustomField object which specifies all three of them?