How to correctly specify duplicate_check_fields via API

How to correctly specify duplicate_check_fields via API

Hi,

I have some code setup which is inserting a new Contact into ZohoCRM via a website enquiry form. This all works perfecltly fine using the below structure.

I'm using this API end-point:  https://www.zohoapis.eu/crm/v2/Contacts/upsert

  1.  
  2. $data['data'] = [
  3. [
  4. "First_Name" => ''.$customer['field_0'].'',
  5. "Last_Name" => ''.$customer['field_1'].'',
  6. "Email" => ''.$customer['field_3'].'',
  7. "Phone" => ''.$customer['field_2'].'',
  8. "Mobile" => ''.$customer['field_2'].'',
  9. "Lead_Source" => ''.$lead_source.'',
  10. "Owner" =>[
  11. "id"=> $owner_id
  12. ]
  13. ]
  14. ];

  15. $fields = json_encode($data);

Because we will have additional types of data capture that might well capture the same customer, we want to be able to update or insert the same contact, but only under specific circumstances.

For example it would be useful if we could check BOTH the Email address AND Lead_Source for a duplicate and thus UPDATE the record, if BOTH clauses are not true, then it inserts a new entry.

This would allow us to add the same contact with the same email address, but as a secondary entry if the Lead_Source were to change.

Lead sources are not unique to a customer, many contacts may have made an enquiry through the same form, but different forms will use a different Lead_Source which is used as a reference to how the customer got in touch.

I tried adding the following, but sadly, when submitting the same email address and lead source it seems to default to validating ONLY the email address and ignoring everything else.

If I change the Lead_Source, it still only dedects the email is a duplicate.

  1. "Owner" =>[
  2.        "id"=> $owner_id
  3.      ],
  4.       "duplicate_check_fields" => 'Contacts - Lead_Source,Email'

I even tried without specifying the email address, but  just the Lead_Source, I get the same result.

Here is part of the response: 

{"data":[{"code":"SUCCESS","duplicate_field":"Email","action":"update","details":{"Modified_Time":"2018-12-17T18:18:05+00:00"...

Can someone please confirm if this is correct and if it's possible at all to specify mutiple fields that should all be checked and return TRUE in defining a duplicate that should be updated.

Thanks