picqer / exact-php-client

PHP Client library for Exact Online
MIT License
165 stars 200 forks source link

How to update contacts who are having same name ? #660

Closed sadiqk2 closed 4 weeks ago

sadiqk2 commented 1 month ago

$contact = new Contact($connection); $contact->FirstName = "firstname" $contact->Account ="ID" $contact->Phone = "mobile"; $contact->Initials = "testing"; $contact->BusinessFax = "testing"; $contact->Mobile = "testing"; $contact->Email = "testing"; $contact->JobTitleDescription = "testing"; $contact->ID = $contact->findId($contact->FirstName, 'FirstName') ?? $contact->ID; $contact->save(); how to save or update if contact with same is already on exact associated with other relation

sadiqk2 commented 1 month ago

$contact = new Contact($connection); $contact->FirstName = "firstname" $contact->Account ="ID" $contact->Phone = "mobile"; $contact->Initials = "testing"; $contact->BusinessFax = "testing"; $contact->Mobile = "testing"; $contact->Email = "testing"; $contact->JobTitleDescription = "testing"; $contact->ID = $contact->findId($contact->FirstName, 'FirstName') ?? $contact->ID; $contact->save(); how to save or update if contact with same is already on exact associated with other relation

in this case it throws error not linked contact group

remkobrenters commented 1 month ago

You should not rely on the name (or any other field that is not 100% guaranteed unique for the user) to identify. Either you keep track of the ID of the contact when creating (so you can refer to that specific ID without having to search) or, if that is not possible, you use a more specific set of filters (like a match on email + first name + last name).

sadiqk2 commented 1 month ago

You should not rely on the name (or any other field that is not 100% guaranteed unique for the user) to identify. Either you keep track of the ID of the contact when creating (so you can refer to that specific ID without having to search) or, if that is not possible, you use a more specific set of filters (like a match on email + first name + last name).

is it possible to delete all first then add them again ,the reason data is not properly synced

remkobrenters commented 1 month ago

Yes. Just fetch them all and loop through them with a delete request. There is no bulk delete as far as I know.

sadiqk2 commented 1 month ago

Yes. Just fetch them all and loop through them with a delete request. There is no bulk delete as far as I know.

is a way to dump all guids from exact and have it on app properly? as deletion is somthing somtimes breaking if the contact are added as main contact

remkobrenters commented 1 month ago

Not that I know. Think through the UI or through the API is equally a lot of work and steps to delete a big datasets.