Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-3815

when xxx_add fails because of a dupe_check, return the xxx_id.

    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.

        Attachments

          Activity

            People

            • Assignee:
              shailesh Shailesh Lende
              Reporter:
              brightbyte Daniel Kinzler
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified