Details
-
Type: New Feature
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.1
-
Fix Version/s: 2.2.0
-
Component/s: CiviCRM API
-
Labels:None
Description
Using the dupe_check option would be much nicer if in case a dupe is found, the id of that dupe would be returned. That is, after calling civicrm_contact_add, the result should contain the field contact_id, even if no new record was created because a matching contact was already present in the database. Samefor civicrm_contribution_add, etc.
Right now, an add-opetation that failes because of a dupe-check returns something like this:
[is_error] => 1
[error_message] => Found matching contacts: 107
It would be much nicer to have this:
[is_error] => 1
[error_message] => Found matching contacts: 107
[contact_id] => 107
This way, the subsequent code could use the resulting contact_id, never mind if it was newly created or not. As it is now, the options are:
- detect if the request failed because of a dupe check based on the error message. then:
a) parse the message to fetch the id, or
b) start a search query to find the id
both options are not very good.