Problem getting custom fields to work

I am using the php API and having problems populating the custom fields in my list. I am calling subscriberAddWithCustomFields passing the email, name, and an array of the fields.

I turned on some debugging in the makeCall method and I see the fields have gotten passed to it and it makes the call successfully. Example:

makeCall: options: = Array
(
    [params] => Array
        (
            [ListID] => __REMOVED__
            [email]=> me@2.com
            [Name] => louis
            [CustomFields] => Array
                (
                    [SubscriberCustomField] => Array
                        (
                            [0] => Array
                                (
                                    [Key] => Address
                                    [Value] => asdfasdf
                                )

                            [1] => Array
                                (
                                    [Key] => City
                                    [Value] => 
                                )

                            [2] => Array
                                (
                                    [Key] => State
                                    [Value] => 
                                )
                        )
                )
        )
)

The custom field keys DO match the Personalization Tag.

If I log into my account I can see that it has added a record for the subscription however the custom fields are empty.

Can you please help, I feel like I am following the examples correctly. Not sure what is going on.

Thanks.

louiswalch louiswalch, 7 years ago

Nevermind. I figured it out.

I had renamed your array2xml function (because our cms has one by the same name) and not renamed all the calls to this function so it had been using mine - which doesn't format exactly the same as yours.

I might offer up the advice to package this a little better to avoid conflicts when plugging into existing application. The functions array2xml and xml2array are pretty common names, it would be preferred if these were moved into your class.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098