cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk Add - No fields update but everything else works

All Star

Bulk Add - No fields update but everything else works

So I've been using the PHP SDK to send a bulk import of contacts to a specific list and with new updated contact info.  I receive no errors, when I generate a report, everything is complete and good.  My contacts are placed in the appropriate list, but no fields besides email are updated.  I have tried many different things, but can not for the life of me figure out why besides a possible API bug that this isn't working.  Below is a sample of the Json being sent:

 

{
    "import_data": [
        {
            "email_addresses": [
                "user@email.com"
            ],
            "addresses": [
                {
                    "line1": "1234 User Street",
                    "city": "User City",
                    "address_type": "PERSONAL",
                    "state_code": "MN",
                    "postal_code": "55372"
                }
            ],
            "custom_fields": [
                {
                    "name": "Custom Field 5",
                    "value": "Some Text Here"
                },
                {
                    "name": "Custom Field 6",
                    "value": "Some Text Here"
                },
                {
                    "name": "Custom Field 7",
                    "value": "Some Text Here"
                },
                {
                    "name": "Custom Field 8",
                    "value": "Some Text Here"
                },
                {
                    "name": "Custom Field 9",
                    "value": "Some Text Here"
                }
            ]
        },
        {
            "email_addresses": [
                "user@email.com"
            ],
            "addresses": [
                {
                    "line1": "1234 User Street",
                    "city": "User City",
                    "address_type": "PERSONAL",
                    "state_code": "MN",
                    "postal_code": "55372"
                }
            ],
            "custom_fields": [
                {
                    "name": "Custom Field 5",
                    "value": "Some Text Here"
                },
                {
                    "name": "Custom Field 6",
                    "value": "Some Text Here"
                },
                {
                    "name": "Custom Field 7",
                    "value": "Some Text Here"
                },
                {
                    "name": "Custom Field 8",
                    "value": "Some Text Here"
                },
                {
                    "name": "Custom Field 9",
                    "value": "Some Text Here"
                }
            ]
        }
    ],
    "lists": [
        "1234567890"
    ],
    "column_names": [
        "EMAIL",
        "ADDRESS LINE 1",
        "CITY",
        "STATE",
        "ZIP/POSTAL CODE",
        "CUSTOM FIELD 5",
        "CUSTOM FIELD 6",
        "CUSTOM FIELD 7",
        "CUSTOM FIELD 8",
        "CUSTOM FIELD 9"
    ]
}

 

 

This is validated.  I could understand if I'm messing something up with the custom fields as the documentation is a little confusing about this, but the address is pretty straight forward and even that doesn't update. 

 

Below is the print_r of the $addContacts from my PHP:

 

Ctct\Components\Activities\Activity Object
(
    [id] => XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
    [type] => ADD_CONTACTS
    [status] => 
    [start_date] => 
    [finish_date] => 
    [created_date] => 
    [error_count] => 0
    [contact_count] => 757
)
Ctct\Components\Activities\AddContacts Object
(
    [import_data] => Array
        (
            [0] => Ctct\Components\Activities\AddContactsImportData Object
                (
                    [email_addresses] => Array
                        (
                            [0] => user@email.com
                        )

                    [addresses] => Array
                        (
                            [0] => Ctct\Components\Contacts\Address Object
                                (
                                    [line1] => 1234 User Street
                                    [city] => User City
                                    [address_type] => PERSONAL
                                    [state_code] => MN
                                    [postal_code] => 55372
                                )

                        )

                    [custom_fields] => Array
                        (
                            [0] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 5
                                    [value] => Some Text Here
                                )

                            [1] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 6
                                    [value] => Some Text Here
                                )

                            [2] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 7
                                    [value] => Some Text Here
                                )

                            [3] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 8
                                    [value] => Some Text Here
                                )

                            [4] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 9
                                    [value] => Some Text Here
                                )

                        )

                )

            [1] => Ctct\Components\Activities\AddContactsImportData Object
                (
                    [email_addresses] => Array
                        (
                            [0] => user@email.com
                        )

                    [addresses] => Array
                        (
                            [0] => Ctct\Components\Contacts\Address Object
                                (
                                    [line1] => 1234 User Street
                                    [city] => User City
                                    [address_type] => PERSONAL
                                    [state_code] => MN
                                    [postal_code] => 55372
                                )

                        )

                    [custom_fields] => Array
                        (
                            [0] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 5
                                    [value] => Some Text Here
                                )

                            [1] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 6
                                    [value] => Some Text Here
                                )

                            [2] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 7
                                    [value] => Some Text Here
                                )

                            [3] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 8
                                    [value] => Some Text Here
                                )

                            [4] => Ctct\Components\Contacts\CustomField Object
                                (
                                    [name] => Custom Field 9
                                    [value] => Some Text Here
                                )

                        )

                )
                
       )

    [lists] => Array
        (
            [0] => 1234567890
        )

    [column_names] => Array
        (
            [0] => EMAIL
            [1] => ADDRESS LINE 1
            [2] => CITY
            [3] => STATE
            [4] => ZIP/POSTAL CODE
        )

)

 

Here is my PHP Code:

 

------------------------------------------------------------------

 

function ccBulkImport($cc, $ss, $listID) {
		
		try {
			
			$contacts = array();
			
			foreach ($ss as $s) {
				
				$contact = new AddContactsImportData();
				$contact->addEmail($s->getEmail());
				
				$address = new Address();
				$address->line1 = $s->getAddress1();
				$address->city = $s->getCity();
				$address->address_type = 'PERSONAL';
				$address->state_code = $s->getState();
				$address->postal_code = $s->getZip();
				$contact->addAddress($address);
		
				$customField = new CustomField();
				$customField->name = "Custom Field 5";
				$customField->value = date("l\, F jS", strtotime($s->getNextPickUpDate()));
				$contact->addCustomField($customField);
				
				$customField = new CustomField();
				$customField->name = "Custom Field 6";
				$customField->value = $s->getAddress1();
				$contact->addCustomField($customField);
		
				$customField = new CustomField();
				$customField->name = "Custom Field 7";
				$customField->value = $s->getCity();;
				$contact->addCustomField($customField);
				
				$customField = new CustomField();
				$customField->name = "Custom Field 8";
				$customField->value = $s->getState();
				$contact->addCustomField($customField);
				
				$customField = new CustomField();
				$customField->name = "Custom Field 9";
				$customField->value = $s->getZip();
				$contact->addCustomField($customField);
				
				$contacts[] = $contact;
			}
			
			$addContacts = new AddContacts($contacts, array($listID));		
			$activity = $cc->addCreateContactsActivity($this->accessToken, $addContacts);
			
		} catch (CtctException $ex) {
			foreach ($ex->getErrors() as $error) {
				print_r($error);
			}
		}
}

 

That's what I got.  Any help would be truely appreciated!

2 REPLIES 2
Honored Contributor

Re: Bulk Add - No fields update but everything else works

Hello,

 

Thank you for being so thorough with the information provided! This has made it much easier to see what is happening and diagnose the cause of your problem. Based on what I have seen so far and from my own tests using your example data as a structure, it appears that this is working correctly for creating any new contacts as well as updating address information. There is however a known issue that we are working on that will cause Custom Fields to not be added to a pre-existing contact when the information is submitted through a bulk activity.

 

This issue has been slated as a high priority and we are currently aiming to have a fix available for this issue before the end of this week. If this update does not resolve your issue, the next step would be to send us an email with some additional information, such as:

- Account Name

- Contacts that are not updating properly

- Example of unedited JSON payload

 

If we do need to perform additional troubleshooting, you can send this information to webservices@constantcontact.com. If you have any questions, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer
All Star

Re: Bulk Add - No fields update but everything else works

Just wondering if the fix you mentioned has been implemented as my recent test has produced the same thing.  If you have, then contacting webservices will be my next step.