updateContact documentation

Regular Participant

updateContact documentation

Hi -

 

I'm trying to get updateContact to work and have had some problems. At some point I even ended up with the contact being marked Removed.

 

My code:

 

$contactsFound = array();

if ($oldClientVO != null && ($contactsFound = $constantContact->searchContactsByEmail($oldClientVO->getEmail()))) {
foreach ($contactsFound as $onlineContact) {
$onlineContact->emailAddress = $clientVO->getEmail();
if (!$constantContact->updateContact($onlineContact)) {
Zend_Registry::get('logger')->log("Error saving constant contact entry.", Zend_Log::ERR);
}
}
} else {

// add contact
}

 

Thanks!

Dave

4 REPLIES 4
Regular Participant

I found another post that answered the question. Even though I searched a contact I found that I still need to reset the list(s) the contact belongs to. Strange a searc h did not return that.

 

Dave

Sorry for the confusion.  Search contact returns a subset of the Contact information, which does not include the lists that they are on.  In order to get their current lists, you would need to retrieve the full Contact information if you found that the Contact did exist.

Dave Berard
Senior Product Manager, Constant Contact
Regular Participant

Thanks for the reply.

 

Would I call getContactDetails() for that. If so, what is the key for that method?

 

Dave

Hi Dave,

 

When you use the searchContacts functions, you get an array of contact objects. These contain identifiers.  You use them to call getContactDetails($contactOjbect), which should return an object with full contact details. You modify the contact lists in this object, and then pass it to the updateContact() function.

 

That should be a workable flow for you.

 

Mark Coleman
Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page